title: How to hide bar button item
body: <p>My screen flow is as follow</p>
  
  <p>Login -> Registration -> CarDetails </p>
  
  <p>All 3 above screens are in navigation-controller, but users are not allowed to go back from Car-Details to Registration. To achieve it, I've</p>
  
  <pre><code>override func viewWillAppear(animated: Bool)
      {
          self.navigationItem.setHidesBackButton(true, animated:true);
      } 
  </code></pre>
  
  <p>in CarDetails view controller. So it hides the back button which automatically gets created if controller is in navigation-controller.</p>
  
  <p>So far it is good.</p>
  
  <p>After providing all detail user lands on Home Screen where I've slide out menu. From menu user can goto to CarDetail Screen as well (to update). That time instead of backButton I need slide-out menu button as left bar button. So I've created it using storyboard. </p>
  
  <p>The problem is that it is getting displayed after Registration view as well. I need conditional show/hide functionality for it in Car-Details View.</p>
  
  <p>I've hook for it as well, as following</p>
  
  <pre><code>override func viewDidLoad()
  {
      super.viewDidLoad()
  
  
      if menuButtonVisibility
      {
  
          if self.revealViewController() != nil
          {
              menuButton.target = self.revealViewController()
              menuButton.action = "revealToggle:"
              self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
          }
      }
  
      else
      {
  
      }
  
      menuButtonVisibility=true
  }
  </code></pre>
  
  <p>I only need the line to put in else block.</p>
  
  <p><a href="https://i.stack.imgur.com/ArJKz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ArJKz.png" alt="enter image description here"></a></p>