How can I change Swift to set StatusBar background color?
Before this code worked es expected.
func setStatusBarStyle(_ style: UIStatusBarStyle, backgroundColor:UIColor = .clear) {
if let statusBar = UIApplication.shared.value(forKey: "statusBar") as? UIView {
statusBar.backgroundColor = backgroundColor
statusBar.setValue(style == .lightContent ? UIColor.white : .black, forKey: "foregroundColor")
}
}
and now with Xcode11 I get compile Fatal Error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.'
any thought would be appreciated