If I segue from view controller 1 to view controller 2, and then segue from view controller 2 to view controller 3, then unwind from view controller 3 to view controller 1, what happens to view controller 2? What happens when I segue to view controller 2 again? Will it run the viewDidLoad method again? What should I do?
Accepted Reply
When you unwind, you dismiss the view controller you come from.
if you unwind from 3 -> 1, controller 2 will still exist, controller 3 is dismissed
if you segue again to controller2, you'll create a new (second) instance. So you should take care
Here is a discussion about this "problem"
h ttps://stackoverflow.com/questions/8311323/it-is-possible-to-use-an-existing-viewcontroller-with-performseguewithidentifier
I found also this interesting to better understand how it works:
h ttps://developer.apple.com/library/content/technotes/tn2298/_index.html
h ttps://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use-them
Replies
When you unwind, you dismiss the view controller you come from.
if you unwind from 3 -> 1, controller 2 will still exist, controller 3 is dismissed
if you segue again to controller2, you'll create a new (second) instance. So you should take care
Here is a discussion about this "problem"
h ttps://stackoverflow.com/questions/8311323/it-is-possible-to-use-an-existing-viewcontroller-with-performseguewithidentifier
I found also this interesting to better understand how it works:
h ttps://developer.apple.com/library/content/technotes/tn2298/_index.html
h ttps://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use-them