Steve Harris Steve Harris - 1 year ago 136
Swift Question

How to do unwind segue in Xcode

enter image description here

I have a tab bar controller and two destination views, one of which is a table view (static cells) and the other is a view controller.
I can do a segue from one cell of the tableview to the yellow view controller but how can I do an unwind segue?
I know unwind segues require some code in the destination view controller but there are no destination view controllers in this case because the table view doesn't have a separate controller and neither does the tab bar controller

Answer Source

To implement Unwind Functionality, you have to firstly declare this function in your root view controller

@IBAction func performUnwindSegue(segue: UIStoryboardSegue)

then right click Exit menu of your root view controller in storyboard, that unwind function could be visible. Line it to your button in child view controller, then it should work.

A simple example could be found here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download