Deciding if an invoked segue should be performed

suggest change

shouldPerformSegueWithIdentifier:sender:

The Objective-C selector is shouldPerformSegueWithIdentifier:sender:. This Swift 3 override is the one to implement:

func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool

Determines whether the segue with the specified identifier should be performed.

Parameters

Identifier: the string that identifies the triggered segue

Sender: the object that initialized the segue

Example in Swift

Perform the segue only when the identifier is SomeSpecificIdentifier. Every other identifier returns false, which cancels that segue.

override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
    return identifier == "SomeSpecificIdentifier"
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents