title: How to call performSegueWithIdentifier in Swift
body: <p>I have created a prepareForSegue method and I am trying to call it from a button that I created by using the performSegueWithIdentifier method. The app is crashing when I load the simulator and it's not getting me a complete error message. Can someone please lead me in the right direction? </p>
  
  <pre><code>import Foundation
  import UIKit
  import Alamofire
  import FBSDKCoreKit
  import FBSDKShareKit
  import FBSDKLoginKit
  
  class PageContentViewController: UIViewController {
  
      @IBOutlet weak var logoImageView: UIImageView!
      @IBOutlet weak var contentLabel: UILabel!
      @IBOutlet weak var backgroundImageView: UIImageView!
  
  
      @IBOutlet weak var pageControl: UIPageControl!
  
      @IBOutlet weak var facebookButton: UIButton!
  
      var index : Int = 0
      var logoFile: String = ""
      var content: String = ""
      var backgroundFile: String = ""
  
      let facebookReadPermissions = ["public_profile", "email", "user_friends"]
  
      override func viewDidLoad() {
          super.viewDidLoad()
          pageControl.currentPage = index
  
          facebookButton.hidden = (index == 3 ) ? false : true
          pageControl.hidden = (index == 3) ? true: false
  
          logoImageView.image = UIImage(named: logoFile)
          contentLabel.text = content
          backgroundImageView.image = UIImage(named: backgroundFile)
      }
  
  
  
      override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
  
          if let destinationController = segue.destinationViewController as? PaymentSubViewController
              where segue.identifier == "payment" {
                  // Do something with `destinationController`
          }
      }
  
  
      @IBAction func test(sender: AnyObject) {
  
             self.performSegueWithIdentifier("payment", sender: self)
  
      }
  
  
  
  
      @IBAction func fbTouched(sender: AnyObject) {
          FBSDKLoginManager().logInWithReadPermissions(self.facebookReadPermissions, handler: { (result:FBSDKLoginManagerLoginResult!, error:NSError!) -&gt; Void in
              if error != nil {
                  //According to Facebook:
                  //Errors will rarely occur in the typical login flow because the login dialog
                  //presented by Facebook via single sign on will guide the users to resolve any errors.
  
                  // Process error
                  FBSDKLoginManager().logOut()
              } else if result.isCancelled {
                  // Handle cancellations
                  FBSDKLoginManager().logOut()
              } else {
                  let fbToken = result.token.tokenString
  
                  Alamofire.request(Router.FacebookAuth(fbToken)).validate(statusCode: 200 ..&lt; 300).responseJSON(completionHandler: { (request, response, JSON, error) in
                      if let json = JSON as? Dictionary&lt;String, AnyObject&gt; {
                          if let token = json["token"] as? String {
                              Router.OAuthToken = token
                              self.performSegueWithIdentifier("showHomeFeed", sender: self)
                          }
                      }
                  })
              }
          })
      }
  
  }
  </code></pre>