title: Open (i.e. go to) specific segue from UITabBarController (Swift)
body: <p><a href="https://i.stack.imgur.com/M0Zo1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M0Zo1.png" alt="Sample Image"></a></p>
  
  <p>In Swift 2, Xcode 7.1</p>
  
  <p>As the image above, <code>TabBarController</code> will be the main view. Anonymous user can go to the home tab, if they click on the "Me" (Profile) tab, I want the app will pop up the new login segue (navigation controller). User need to login 1st before they can go into the "Me" tab.</p>
  
  <p>Currently I have override the <code>TabbarControllerDelegate</code> in the TabBarController class, which as below (I use Parse, so <code>user = PFUser.currentUser()</code>, Parse will cache the user):</p>
  
  <pre><code>func tabBarController(tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -&gt; Bool {
  
  
      if (viewController is MeViewController &amp;&amp; user == nil) {
  
          print("login \(viewController)")
  
          // How could I go to the Login Segue from here?
  
          return false
  
      } else {
          return true
      }
  }
  </code></pre>
  
  <p>How could I achieve my goal from here? Or any better advice? Btw, I am not able to use <code>performSegueWithIdentifier</code> with the <code>TabBarController</code> class unless I use it within the <code>ProfileViewController</code> class (UIViewController) to achieve it. But if I did that, the app will display the view in 'Me' Tab first then go to the 'Login' segue, which is not what I wanted</p>
  
  <p>It will be great thanks for any advices</p>