This is the code I written in AppDelegate class (Swift 4):
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UIApplication.shared.statusBarStyle = .lightContent
goToRootViewController()
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
GMSServices.provideAPIKey(googleMapApiKey)
return true
}
but my status bar is not showing the light content I dont know what is ging on, Any help?
In your viewcontroller class use this code below viewDidLoad() :
override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
this will show your status bar in light content
Set "View controller-based status bar appearance" Key with Value "NO" in your product's Info.plist
Then Use Following code in AppDelegate.Swift inside "didFinishLaunchingWithOptions":
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UIApplication.shared.statusBarStyle = .lightContent
return true
}