title: How to segue programmatically in iOS using Swift
body: <p>I'm creating an app that uses the Facebook SDK to authenticate users. I'm trying to consolidate the facebook logic in a separate class. Here is the code (stripped for simplicity):</p>
  <pre><code>import Foundation
  
  class FBManager {
      class func fbSessionStateChane(fbSession:FBSession!, fbSessionState:FBSessionState, error:NSError?){
          //... handling all session states
          FBRequestConnection.startForMeWithCompletionHandler { (conn: FBRequestConnection!, result: AnyObject!, error: NSError!) -&gt; Void in
          
              println(&quot;Logged in user: \n\(result)&quot;);
          
              let storyboard = UIStoryboard(name: &quot;Main&quot;, bundle: NSBundle.mainBundle())
              let loggedInView: UserViewController = storyboard.instantiateViewControllerWithIdentifier(&quot;loggedInView&quot;) as UserViewController
          
              loggedInView.result = result;
          
              //todo: segue to the next view???
          }
      }
  }
  </code></pre>
  <p>I'm using the above class method to check session state changes, and it works fine.</p>
  <p><strong>Q:</strong> Once I have the user's data, how can I segue to the next view from within this custom class?</p>
  <p>Just to be clear, I have a segue with identifier on the storyboard, and I'm trying to find a way to perform a segue from a class which is not the view controller</p>