Omar Eyad Abubaker Omar Eyad Abubaker - 6 months ago 45
Swift Question

the segue action unwindFromChildView is not defined

I am working on somebody else's code and I'm trying to execute a few lines whenever the exit segue is performed, I connect the exit outlet of my viewcontroller in interface builder to the function unwindFromChildView which is in my .swift file but I receive the error :-
the segue action unwindFromChildView is not defined

Answer

Make sure that the signature of the unwindFromChildView func is correct, this is key on getting the unwind segues to work. iOS will look for that signature in the view controllers in your navigation stack, and will unwind the stack to the view controller that has that method.

-(IBAction)unwindFromChildView :(UIStoryboardSegue *)segue {
   // whatever
 }

Swift:

@IBAction func unwindFromChildView (segue: UIStoryboardSegue) {
    return
}

I hope this helps.