I am trying to hide status bar in one of my UIViewControllers (Swift 4).
Firstly, I set View controller-based status bar appearance to
If you are presenting the view controller modally, try
viewController.modalPresentationCapturesStatusBarAppearance = true