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 create a hosting controller by inheriting UIHostingController and then change the statusBarStyle like this:
And then you can set this hosting controller as your window root view controller in Scene Delegate like this:
I hope this will work for you and as of now I believe the only way is using HostingController.