Search code examples
iosswiftuiviewcontrollerstatusbaruicolor

Is it possible to change Status Bar color for all view controllers?


I have been searching for a while now and I only found answers that describe to change color on one view controller not for all view controllers.

Is it possible to do it?


Solution

  • Set the style of the status bar in AppDelegate.swift:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        UIApplication.shared.statusBarStyle = .lightContent
    
        return true
    }
    

    And add the following code to your Info.plist:

    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>