title: changing nav bar item programmatically in Swift
body: <p>So I'm trying to change the left nav bar button item in viewWillAppear (the item needs to be changed back and forth, so viewDidLoad won't work). I have the following code in viewWillAppear:</p>
  
  <pre><code>        // There is a diff 'left bar button item' defined in storyboard. I'm trying to replace it with this new one
          var refreshButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Refresh, target: self, action: {})
          self.navigationController.navigationItem.leftBarButtonItem = refreshButton
          // title and color of nav bar can be successfully changed
          self.navigationController.navigationBar.barTintColor = UIColor.greenColor()
          self.title = "Search result"
  </code></pre>
  
  <p>I used debugger to make sure every line is executed. But the 'leftBarButtonItem' wasn't updated. nav bar stuff however got updated successfully. I'm out of moves now. Ideas? Thanks!</p>