performSegueWithIdentifier in swift

Lola picture Lola · Jun 4, 2014 · Viewed 22.2k times · Source

If I have this Objective C code:

[self performSegueWithIdentifier:@"push" sender:self];


and

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([segue.identifier isEqualToString:@"push"]) {

}

What is the Swift equivalent?

Answer

onevcat picture onevcat · Jun 4, 2014
self.performSegueWithIdentifier("push", sender: self)

override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if segue.identifier == "push" {

}

You have a typo in your self.preformSegueWithIdentifier