Warning message on statusBarStyle on set lightContent

3.3k views Asked by At

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.

2

There are 2 answers

2
regina_fallangi On

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.

1
drodriguez On

for me it worked this way

    override var preferredStatusBarStyle: UIStatusBarStyle { 
       return .lightContent 
    }