how am I supposed to change this piece of code? The current solutions for this problem either cover older iOS versions or are unanswered. This is the line:
UIApplication.shared.statusBarStyle = .lightContent
And I get those warnings:
'statusBarStyle' was deprecated in iOS 13.0: Use the statusBarManager property of the window scene instead.
'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead
The code works, but would be nice to do not have those warnings popping up


You can override this property in your view controller :
Plus you can get the value of statusBarStyle like this:
but this is only get only property. In order to change the status bar style you can use the above code by overriding the ViewController property.
In case you want to change the status bar style of whole app then you can use info.plist like this: Add "UIViewControllerBasedStatusBarAppearance" key and set its value to "false"
And then add "UIStatusBarStyleLightContent" key and set its value to "UIStatusBarStyle".