How do I change the statusBarStyle using the statusBarManager in iOS 13.0+

400 Views Asked by At

I am trying to change the status bar style in my iOS 13.0 app but when I use the code;

   UIApplication.shared.statusBarStyle = .lightContent

I get the warning in Xcode;

   'statusBarStyle' was deprecated in iOS 13.0: Use the statusBarManager property of the window scene instead

The problem is that the property statusBarManager?.statusBarStyle is a get only property so how can I change the status bar style programmatically?

1

There are 1 best solutions below

1
Stephen501 On

Set View controller-based status bar appearance key value in info.plist to NO and programmatically set UIApplication.shared.statusBarStyle to either .lightContent or .default.