Unwind segue 在 Swift 3 和 iOS 10 中不起作用

Unwind segue doesn't work in Swift 3 and iOS 10

我正在尝试在 iOS 10 和 Swift 3 中测试 unwind segue。

我做了一个像这样的简单应用程序:

我在 TableViewController class 中添加了 segue 代码并连接 "Cancel" 按钮并在 Table 上退出查看控制器场景:

@IBAction func unwindToRootViewController(segue: UIStoryboardSegue) {
    print("Unwind to Root View Controller")
}

但我的简单转场不起作用。我做错了什么?

从上面的评论中可以看出问题是这样的:

I add code for segue in TableViewController class

展开转场必须在您的 "outer" ViewController 中,而不是 TableViewController

This article 很好地介绍了 unwind segues。