title: Change Status Bar Color in Real Time
body: <p>I am moving in a side menu view controller (<a href="https://github.com/evnaz/ENSwiftSideMenu" rel="nofollow">ENSwiftSideMenu</a>) with an animation. Since the side menu's background color is a pretty dark blue, I'd like to have the status bar, that is black by default, turn light while the menu is visible.<br>
  With <code>View controller-based status bar appearance</code> being set to <code>YES</code> (also tried <code>NO</code>) inside the <code>info.plist</code>, I tried to implement the following code which did, unfortunately, not work:</p>
  
  <pre><code>UIApplication.shared.statusBarStyle = .lightContent
  </code></pre>
  
  <p>Also, I tried this:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      setNeedsStatusBarAppearanceUpdate()
  }
  
  override var preferredStatusBarStyle: UIStatusBarStyle {
      return .default
  }
  </code></pre>
  
  <p>Any idea how to make it work?<br>
  Thanks!</p>