I have added the second window in my app for presenting the specific controller when user taps the remote push notification.
func navigateThroughPushnotification(controller: UINavigationController) {
let window = UIWindow(frame: UIScreen.main.bounds)
let vc = UIViewController()
vc.view.backgroundColor = .clear
window.rootViewController = vc
window.windowLevel = UIWindow.Level.alert + 1
window.makeKeyAndVisible()
if let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView {
statusBar.backgroundColor = kAppDefaultColor
}
vc.present(controller, animated: true, completion: nil)
}
Problem is that I want to change the status bar color of this window also but the code which I have used to change the color of my main window doesn't work this time.
guard let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView else { return true }
statusBar.backgroundColor = kAppDefaultColor
Now this code works very well for the main window. Please someone help to detect what should be done to change the color of the second window. Thanks in advance