I'm stuck with unwind segue that doesn't work for some reason, I do everything as described in tutorial: cntrl drag to exit and select unwind action from another controller (please see gif attached). When I run it on my iphone and tap Cancel, nothing happens.
Asked
Active
Viewed 627 times
1

Elena Rubilova
- 367
- 4
- 16
1 Answers
1
It looks like the view controller you're trying to unwind from is already the bottom of the UINavigationController
's stack, so it's not going to do anything when the unwind is called.
If that UINavigationController
is being called modally, call
self.navigationController?.dismiss(animated: true, completion: nil)
within the view controller where the button is being pressed.

Bradley Mackey
- 6,777
- 5
- 31
- 45
-
I don't think this answer is correct. The view controller's placement on the storyboard doesn't determine where it is in the stack. That will be determined at runtime. I'm sure `self.navigationController?.dismiss(animated: true, completion: nil)` did dismiss the view controller, but it's not because you got the unwind segue to work. It's because this is an alternative way to dismiss a view controller. Unless you also removed the unwind segue, it's probably still just sitting there never being called. – Jim Dec 15 '19 at 19:37