Reputation: 11257
I have around 6 segues that perform the same action in the prepareForSegue method, however, I want to skip this action for my unwind segue but I can't figure out how to determine if the segue being passed is an unwind segue or not.
Any help would be appreciated.
Upvotes: 5
Views: 4552
Reputation: 1
Im pretty new to SWIFT myself. But I believe theres some misunderstanding here. If you add an unwind segue yourself, prepareForSegue is triggered. But on clicking 'back' button that automatically shows in the navigation bar, the prepareForSegue is in fact not fired.
Upvotes: 0
Reputation: 1462
prepareForSegue
is only called in the forward direction. It is not called when you unwind. To handle unwind segues, you need to connect your exit button to an IBAction method that takes a segue as a parameter. This method will be called when you unwind.
This post has more details about how to use them.
Upvotes: 1
Reputation: 11257
Ah, nevermind, Robotic Cat had the answer, which is basically give the unwind segue an identifier. I couldn't figure out how to do this until I realized you can select segues from the pullout panel on the left of storyboard and set the identifier from there.
Thanks!
Upvotes: 17