0

How to resolve this issue warning issue

UIApplication.shared.statusBarStyle = .lightContent

Warning Messages

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

kiran
  • 4,285
  • 7
  • 53
  • 98

2 Answers2

2

Use the statusBarManager (UIStatusBarManager):

Overwrite the preferredStatusBarStyle in your view controller and do this:

override var preferredStatusBarStyle: UIStatusBarStyle {
    .lightContent
}

You can have a BaseViewController: UIViewController {} class that controls that and make that all your VCs inherit from it.

regina_fallangi
  • 2,080
  • 2
  • 18
  • 38
  • 1
    Your first suggestion returns this error: `Cannot assign to property: 'statusBarStyle' is a get-only property` – Amy Sep 21 '22 at 15:34
  • 1
    Yeah, no longer changeable. It is now only possible with the preferred one: https://developer.apple.com/documentation/uikit/uistatusbarmanager/3213942-statusbarstyle – regina_fallangi Sep 23 '22 at 02:52
0

for me it worked this way

    override var preferredStatusBarStyle: UIStatusBarStyle { 
       return .lightContent 
    }
drodriguez
  • 150
  • 2
  • 5