all trying to hide status bar with Xcode 8.2 with swift 3. but I can't hide it.


and also for,

Make sure your initial SwiftUI View is a Navigation view where you hide the status bar. Then if you navigate to a tab bar view or any subsequent views the status bar will be hidden.
If you are using Storyboard , go to the NavigationController , select the navigationBar , click on the Attributes Inspector , then change the style . if you need light content (white status bar) set it anything except default lets say set style black And if you want dark content (black status bar) set it default .
You can Approach this in two ways
Option 1.Try this in
didFinishLaunchingWithOptionsMethod
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    UIApplication.shared.isStatusBarHidden = true
    return true
}
Option 2. override
prefersStatusBarHiddenfunction in yourUIViewController
override var prefersStatusBarHidden : Bool {
    return true
}
Note: you call override func prefersStatusBarHidden it should be override var prefersStatusBarHidden
In swift 3 use this,
override var prefersStatusBarHidden: Bool {  
    return true  
}
Reference link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With