I have three relevant views, they are all connected to a navigation controller, with push segues (also I have stored arrays using prepare for segue with all three). So I want to use dismiss since I don't want to change the already existing stored arrays that are used in the viewcontrollers.
So I'm at viewcontroller C , and im trying to go back to A.
I have until this point used self.dismiss(animated: true, completion: nil)
which works great when dismissing to view B, but I want to go to A.
I have also tried using:
let presentingViewController = self.presentingViewController
presentingViewController?.presentingViewController?.presentingViewController?.dismiss(animated: false, completion: nil)
However this does not work, and produce this error:
pushViewController:animated: called on while an existing transition or presentation is occurring; the navigation stack will not be updated.
Any solution to this?
The reason I want to go to viewcontroller A is because there is a bug in Viewcontroller B when something is updated on Viewcontroller C, so a temporary solution is to just go to A, and reload the tableview.
Call
setViewControllers(_:animated:)
on the navigation controller, passing in an array containing only view controller A. As view controller A is already in the stack, the animation will be a pop.Alternatively, if you’d rather use segue’s, you can perform an unwind segue, back to view controller A.