-1
self.dismiss(animated: false) {
  let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
  self.navigationController?.pushViewController(vc, animated: false)
}
Andrew
  • 18,946
  • 6
  • 54
  • 66

1 Answers1

0

self.navigationController will only have a value if your ViewController is embedded in an UINavigationController otherwise it will be nil. In your case it is nil, so your controller is dismissed successfully but ViewController is not pushed.

In your completion block use self.presentingViewController to push the object.

self.dismiss(animated: false) {
  let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
  self.presentingViewController?.navigationController?.pushViewController(vc, animated: false)
}
udbhateja
  • 751
  • 4
  • 15