Answers for "Expression of type 'UIViewController?' is unused warning when pop view controller in swift 3.0"

0

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)
Posted by: Guest on August-16-2020

Code answers related to "Expression of type 'UIViewController?' is unused warning when pop view controller in swift 3.0"

Code answers related to "Swift"

Browse Popular Code Answers by Language