Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.pageSheet modalPresentationStyle and WindowViewController preferredStatusBarStyle #431

Open
giofid opened this issue Oct 27, 2020 · 1 comment

Comments

@giofid
Copy link

giofid commented Oct 27, 2020

Hi @wtmoose, I'm experiencing a problem with statusBar style when I present a centered swiftMessage in a view controller presented with .pageSheet modalPresentationStyle. I attach a screen below to better explain the problem

I slightly modified the demo project to obtain it. I attach it too.

SwiftMessages-master.zip

Practically, the status bar is black on a black background.
To solve the problem I have to pass config.preferredStatusBarStyle = UIApplication.shared.delegate?.window??.windowScene?.statusBarManager?.statusBarStyle during swiftmessage configuration.

I'm wondering if it's better changing the preferredStatusBarStyle overriding implementation of WindowViewController to something like

override open var preferredStatusBarStyle: UIStatusBarStyle {
      if #available(iOS 13.0, *) {
          return config.preferredStatusBarStyle ?? UIApplication.shared.delegate?.window??.windowScene?.statusBarManager?.statusBarStyle ?? super.preferredStatusBarStyle
      } else {
          return config.preferredStatusBarStyle ?? UIApplication.shared.statusBarStyle
          // OR
          // return config.preferredStatusBarStyle ?? super.preferredStatusBarStyle
     }
 }

I'd really like your opinion about this. Is this an iOS bug?

@wtmoose
Copy link
Member

wtmoose commented Oct 27, 2020

Not sure if it's an iOS bug or if the new modal style revealed the issue with SwiftMessages.

I need to look at the solution a bit. SwiftMessages determines the window scene in Presenter.swift using the following logic:

@available (iOS 13.0, *)
private var windowScene: UIWindowScene? {
    switch config.presentationContext {
    case .windowScene(let scene, _): return scene
    default: return UIApplication.shared.keyWindow?.windowScene
    }
}

So it may be a bit different than what you proposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants