Stats

Contributors: 1 Sunday, August 21, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Deciding if an invoked Segue should be performed.

Download ios eBook

Example

ShouldPerformSegueWithIdentifier:

 func shouldPerformSegueWithIdentifier(_ identifier:String, sender sender:AnyObject?) -> Bool 

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

Parameters

Identifier: String that identifies the triggered segue

Sender: The object that initialized the segue.

Example in Swift

Only perform segue if the identifier is "SomeSpecificIdentifier"

override func shouldPerformSegueWithIdentifier(identifier:String, sender:AnyObject?) -> Bool {
    if identifier == "SomeSpecificIdentifier" {
        return true
    }
    return false
}