title: hide status bar swift 4
body: <p>I am trying to hide status bar in one of my UIViewControllers (Swift 4).</p>
  
  <ul>
  <li><p>Firstly, I set <strong>View controller-based status bar appearance</strong> to <strong>YES</strong> in <code>Info.plist</code>.</p></li>
  <li><p>I overrode the <code>prefersStatusBarHidden</code> property in my controller:</p></li>
  </ul>
  
  <hr>
  
  <pre><code>override var prefersStatusBarHidden: Bool {
       return true
  }
  </code></pre>
  
  <hr>
  
  <ul>
  <li>And in <code>viewDidLoad()</code>, I added <code>setNeedsStatusBarAppearanceUpdate()</code> function to force the <code>prefersStatusBarHidden</code> property to be read. </li>
  </ul>
  
  <p>After all that, I still see the status bar on that <code>UIViewController</code>.</p>
  
  <p>Can someone help me, please? </p>