Search code examples
iosswiftunwind-segue

Swift: unwind segue doesn't work


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. Description


Solution

  • 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.