Swift3.0的坑

在Swift3.0中有些地方感觉还是很坑的

popViewController方法之坑

在创建导航条后pop界面的时候如果按照原来OC的写法

self.navigationController?.popViewController(animated: false);

会发现程序报一个警告

Expression of type ‘UIViewController?’ is unused

这是因为popViewConctroller方法默认返回了一个UIViewController,点进入有一个解释

Returns the popped controller.

我们把这个返回值处理一下即可

_ = self.navigationController?.popViewController(animated: true)

你可能感兴趣的:(Swift学习,pop,swift,导航,警告消除)