📜  'UIViewController' 类型的表达式?在 swift 3.0 中弹出视图控制器时未使用警告 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:01.787000             🧑  作者: Mango

代码示例1
@IBAction func goBackToIntroView(_ sender: UIButton) {
     
        self.navigationController?.popViewController(animated: true)
    }
//  popViewController(animated:) returnsUIViewController?
// , and the compiler is giving that warning since you aren't capturing the value. The solution is to assign it to an underscore:
// Answer

_ = navigationController?.popViewController(animated: true)