Skip to content

[Feature]: Support dynamic status bar visibility control #63

@sugijotaro

Description

@sugijotaro

Prerequisites

  • I have searched existing issues/discussions to ensure this hasn't been requested

Problem Statement

Introduction

First of all, thank you for providing such a wonderful library! Portal has been incredibly helpful for creating seamless transitions in my project. 🙏

Problem Statement

Currently, PortalContainer accepts a static hideStatusBar boolean at initialization. This makes it impossible to toggle the status bar visibility dynamically based on the application's state (e.g., hiding it only when a specific detail view is presented and showing it otherwise).

Proposed Solution

I propose moving the status bar state management to CrossModel. By using SwiftUI's .statusBarHidden() modifier on the root view of the overlay window (PortalContainerRootView), we can reactively control the status bar visibility from anywhere in the app via the shared portalModel.

API Sketch

The user can control the status bar dynamically by accessing the environment model:


@Environment(CrossModel.self) private var portalModel

// To hide
portalModel.isStatusBarHidden = true

// To show
portalModel.isStatusBarHidden = false

Alternatives Considered

I considered using UIViewController.setNeedsStatusBarAppearanceUpdate() manually, but leveraging SwiftUI's native .statusBarHidden() on the overlay's root view is much more idiomatic and handles animations more smoothly.

Breaking Change?

None

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions