.pageSheet modalPresentationStyle and WindowViewController preferredStatusBarStyle
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.
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?
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.