Popping versus Unwinding

Use an unwind segue when a UINavigationController pop isn’t what you want. For example, when going back beyond the current UINavigationController stack. Note that you can pop one or more levels without needing an unwind when you are within the UINavigationController view stack. 

When just using popping you will want to send the data model(s) to the child view controllers. They act on it directly.

When unwinding you can be more abstract and only pass the essential data pieces, or the model if you still want. Unwinding can communicate back since the child view controller lingers long enough to be scoured for its data.

Unwind segues in Swift

Two essential preparatory reading assignments are:

Apple Technical Note TN2298: Using Unwind Segues

Stack Overflow: What are Unwind segues for and how do you use them?

In Swift 2.3 / iOS 10.0 (I don’t know which is the critical factor) the method signature must be:

Swift 2.3
@IBAction func unwindToTeachView(withUnwindSegue unwindSegue: UIStoryboardSegue) {
        ...
    }

The critical elements are 

  • @IBAction
  • func
  • One parameter
  • withUnwindSegue
  • UIStoryBoardSegue
  • No return value

I found this out on my own. I contributed this answer to another Stack Overflow question, Xcode 6 Storyboard Unwind Segue with Swift Not Connecting to Exit.