I have a mapview that is connected to several viewControllers.
I needed to implement an 'unwind' from another button (as opposed to just the back button), so I used:
self.navigationController?.popViewControllerAnimated(true)
My question is: as the above works, should I even bother trying to implement unwind in code using prepareForUnwind and canPerformUnwindSegueAction in the parent view controller + ctrl-drag from the viewController to exit in Storyboard? If so, why?
Basically if you are just
dimissinga presentedUIViewControlleror popping aUIViewControllerfrom the navigation stack,you don't need to use unwind segues although it does the same for you.But think of a case where there are
UINavigationControllersA,B,C and then aRootViewControllerRThen think of a condition
Now if you want to go back to YVController to your project RootViewController where you just started up.There is no way as
popToRootViewControllerpops to the navigation stack of the BUINavigationController.Now what you do..Either use delegate or change window RootViewController which is not a good idea.So you need to use unwind segue to overcome this.. A sample project to demonstrate the power of using it..