title: Hide navigation bar but also keep background color of status bar
body: <p>I am hiding my navigation bar using the default ios method</p>
  
  <pre><code>self.navigationController?.hidesBarsOnSwipe = true
  </code></pre>
  
  <p>I have a custom green color on my Navigation bar with translucent set to true. However, when the navigation bar hides, the whole custom green color including the color behind the status bar hides as shown in the images below. I want to keep the color behind the status bar the same (With the same translucent navigation bar) even when the navigation bar is hidden so that the table's content does not overlap the status bar. </p>
  
  <p><a href="https://i.stack.imgur.com/9lOGS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9lOGS.jpg" alt="status bar"></a></p>
  
  <p>I tried setting the status bar color manually using the following function. But that does not work well as my navigation bar is translucent and this only seems like a patch fix because The navigation bar is not translucent anymore. And hiding/Adding background to the status bar sometimes creates a poor user experience when transitioning VCs</p>
  
  <pre><code>    func setStatusBarBackgroundColor(color: UIColor) {
      guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
          return
      }
      statusBar.backgroundColor = color
  }
  </code></pre>