You can approach this in two ways.
Option 1 Try this in the didFinishLaunchingWithOptions Method
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { UIApplication.shared.isStatusBarHidden = true return true }
Option 2 override prefersStatusBarHidden function in UIViewController
override var prefersStatusBarHidden : Bool { return true }
Note: you call override func prefersStatusBarHidden , this must be override var prefersStatusBarHidden
source share