title: Swift - Call segue inside of a closure
body: <p>I am trying to call a segue inside of a closure and I can't seem to make it work. The problem is that I don't know how to make the "performSegueWithIdentifier" call since I cannot use the keyword "self" here. </p>
  
  <p>This is being done outside of UIViewController, so I don't know how to call a "performSegueWithIdentifier" without using the keyword "self".</p>
  
  <p>So I would need to create the object where the method is called, but how and which object? Is it the view controller? On the storyboard? or where is it?</p>
  
  <pre><code>func signUp (username: String, password: String) {
      Alamofire.request(.POST, "https://test.xyz.de/api/v1/public/user", parameters:["username" : username, "password": password], encoding: .JSON)
          .responseJSON({ (_, _, JSON, error) -&gt; Void in
              println("Response: \(JSON)")
              if error == nil {
                  self.performSegueWithIdentifier("segueToNextScreen", sender: self) // Problem!!
              } else {
                  println(error)
              }
          })
  }
  </code></pre>
  
  <p>Thanks in advance and let me know if you need further explanation.</p>
  
  <p>Cheers,
  Tiago</p>