How to change the text color of the Status Bar in iOS using Swift?
Hello everyone! I'm a beginner in iOS development with Swift, and I'm having an issue with changing the text color in the status bar (the top bar with time, battery, etc.). I need the text to be white because the background of my app is dark, and the default black text is simply not visible.\n\nI've tried several methods, but none of them worked. Here's what I've tried:\n\n1. In Info.plist, I added the key `UIViewControllerBasedStatusBarAppearance` and set it to `NO`.\n2. In AppDelegate, in the `application(_:didFinishLaunchingWithOptions:)` method, I wrote:\n\n```swift\nUIApplication.shared.statusBarStyle = .lightContent\n```\n\nBut this doesn't work — Xcode gives a warning that `statusBarStyle` is deprecated in iOS 13.\n\n3. Then I tried overriding the method in my ViewController:\n\n```swift\noverride var
No answers yet.
Log in to leave an answer
Blogs