在swift2.x中 有這個(gè)方法
self.navigationController?.popViewController(animated: true)
但是在swift3 就會(huì)出現(xiàn)這個(gè)警告

屏幕快照 2017-01-17 10.25.38.png
解決辦法為:
_ = self.navigationController?.popViewController(animated: true)
Swift 3 大的改動(dòng)之一就是所有帶有返回值的函數(shù)如果沒有變量去接收返回值,就會(huì)報(bào)warning。
popViewController和popToRootViewController基本上人人都用,但是有多少人知道這兩個(gè)函數(shù)其實(shí)是有返回值的。
看一下官方的解釋吧
open func popViewController(animated: Bool) -> UIViewController? // Returns the popped controller.
open func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]?
// 官方解釋
// Pops view controllers until the one specified is on top. Returns the popped controllers.