title: NavigationBar delay updating barTintColor iOS10
body: <p><strong>Context:</strong></p>
  
  <p>Let's say we have one <code>NavigationController</code> and 2 viewControllers. 
  <code>ViewControllerA</code> has a blue navigationBar, while <code>ViewControllerB</code> has a green one.</p>
  
  <p>I set them up like so :</p>
  
  <pre><code>override func viewWillAppear(_ animated: Bool) {
          self.navigationController?.navigationBar.barTintColor = UIColor.blue    // Green if ViewController B
      }
  </code></pre>
  
  <p>It works well when I got from A to B, but when I return, the navigationBar teint is updated after. Like if it was set up in the <code>viewDidAppear</code>.</p>
  
  <p><strong>Expected:</strong></p>
  
  <p>The navigation bar should have its navigation bar color updated without delay. </p>
  
  <p><strong>Solutions tried:</strong></p>
  
  <ul>
  <li><p>I've seen this <a href="https://stackoverflow.com/questions/39511088/navigationbar-coloring-in-viewwillappear-happens-too-late-in-ios-10">SO</a> post, and I tried the solution. It worked, but would make the management of the navigation bar a lot more complex and painful. (in a real app)</p></li>
  <li><p>I've tried to change the navbar teint in the <code>ViewWillDisappear</code> method. Didn't work.</p></li>
  </ul>
  
  <p><strong>More:</strong> </p>
  
  <p>This is caused by a change on the ios10 API. I've read the <a href="https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.0/index.html" rel="noreferrer">release notes</a>, but it's still unclear what should be done in this case.</p>
  
  <blockquote>
    <p>In iOS 10, UIKit has updated and unified background management for
    UINavigationBar, UITabBar, and UIToolbar. In particular, changes to
    background properties of these views (such as background or shadow
    images, or setting the bar style) may kick off a layout pass for the
    bar to resolve the new background appearance. </p>
    
    <p>In particular, this
    means that attempts to change the background appearance of these bars
    inside of layoutSubviews, -[UIView updateConstraints],
    viewWillLayoutSubviews, viewDidLayoutSubviews, updateViewConstraints,
    or any other method that is called in response to layout may result in
    a layout loop.</p>
    
    <p>In some cases you can break these layout loops by ensuring that you
    always use the same object instance when objects (such as UIImage or
    UIColor) are required. But in general you should avoid doing this.</p>
  </blockquote>
  
  <p><strong>Question:</strong></p>
  
  <p>What would be the best way to handle the navigation bar changes between different navigation controllers in iOS 10 ?</p>