Expression of type 'UIViewController?' is unused warning when pop view controller in swift 3.0 code example
Example: Expression of type 'UIViewController?' is unused warning when pop view controller in swift 3.0
@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)