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.
An unwind segue lets you jump to any view controller further up your view controller hierarchy, destroying all view controllers preceding the destination. Before actually creating one, let's overview how an unwind segue works. You implement an unwind method in the destination view controller.
Connect a Triggering Object to the Exit Control In your storyboard, create an unwind segue by right-clicking a triggering object and dragging to the Exit control at the top of your view controller's scene.
An object that prepares for and performs the visual transition between two view controllers.
To create a segue between view controllers in the same storyboard file, Control-click an appropriate element in the first view controller and drag to the target view controller. The starting point of a segue must be a view or object with a defined action, such as a control, bar button item, or gesture recognizer.
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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With