I have an iOS application that displays the bulk of its data on an external display (either via Airplay or physical cable connection). Is it possible to display the device's status bar on the external display? Here's how I'm initializing the external display:
func checkForExistingScreenAndInitializeIfPresent() -> UIViewController? {
if UIScreen.screens.count > 1 {
if let secondScreen = UIScreen.screens.last {
return initializeSecondScreen(with: secondScreen)
}
}
return nil
}
func initializeSecondScreen(with secondScreen: UIScreen) -> UIViewController? {
let screenBounds = secondScreen.bounds
secondWindow = UIWindow(frame: screenBounds)
secondWindow?.screen = secondScreen
secondWindow?.isHidden = false
secondWindow?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "homeViewController")
return secondWindow?.rootViewController
}
I have the following code in my HomeViewController.
override var prefersStatusBarHidden: Bool {
return false
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
The status bar shows up fine in the iOS application for the HomeViewController, but never shows when the HomeViewController is presented on the external display.