I want to create a global function which I can use to show and hide the status bar. Here is what I did:
class Helper {
class func hide() {
let app = UIApplication.sharedApplication()
if !app.statusBarHidden {
app.statusBarHidden = true
}
}
class func show() {
let app = UIApplication.sharedApplication()
if app.statusBarHidden {
app.statusBarHidden = false
}
}
}
Here is how it is called:
Helper.hide()
I put these functions in a helper class. Calling the hide() function does not hide the statusbar.
I also set in info.plist
Status bar is initially hidden
How can I show and hide StatusBar from a global function?