Hide status bar in swift-Programmatically

Hide status bar programmatically using swift - Tutorial

To hide status bar programmatically using swift in IOS is 3 steps procedure. In this post we will show you an example/ tutorial to hide status bar programmatically using swift.

Step 1: Go to info.plist file, select one of its property and click on ‘ + ‘ icon. This will add new row to the file and select ‘ View controller-based status bar appearance ‘ key from the drop down. Set its value to ‘ NO ‘.

Adding View controller-based status bar appearance key to info_plist file
Adding View controller-based status bar appearance key to info.plist file

Step 2: Open ‘ AppDelegate.swift ‘ and in its ‘ didFinishLaunchingWithOptions ‘ function add below code

        
   UIApplication.sharedApplication().statusBarHidden=true;

Step 3: Run your app. You will see no status bar in your app.