I want to popViewController
after I dismiss a modalVC. However my code is not working. What is wrong?
func showMessage(withTitle title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let alertAction = UIAlertAction(title: "ok", style: .default) { (_) in
self.dismiss(animated: true) {
self.navigationController?.popViewController(animated: true)
}
}
alert.addAction(alertAction)
present(alert, animated: true, completion: nil)
}
I have also tried this:
let controller = ViewController()
controller?.popViewController(animated: true)