dimanche 22 mars 2015

Conditional segue from static tableview cell (swift)

I have a segue from a static tableview cell. I would like to check for a nil in my initial view controller with an if statement before allowing the segue to be performed, but I'm not sure what to write to tell the segue to not perform. Maybe something like this?



override func prepareForSegue(segue: UIStoryBoardSegue, sender: AnyObject?) {
if segue.identifier == "myIdentifier" {
if myVariable == nil {
// code to deactivate segue
} else {
//code to perform segue
}
}

Aucun commentaire:

Enregistrer un commentaire