I am trying to make the status bar for one of my view controllers to be hidden (when displayed modally). When I\'m presenting the view controller, the status bar is is to be
If it's not working and your UIViewController is a child in UINavigationController, then this code might be a solution for you.
open override var prefersStatusBarHidden: Bool {
return topViewController?.prefersStatusBarHidden ?? super.prefersStatusBarHidden
}
Basically the UINavigationController uses it's own prefersStatusBarHidden value, but in my case I wanted to overwrite that by its top view controller's property in hierarchy.