Segue prepared, but performance crashes without exception

I have two types: A and B with a modal transition between them. Controller A has @IBAction func unwindSegue(segue: UIStoryboardSegue).

I am trying to perform a segue reversal (back from view B to A) programmatically, which crashes without creating any errors. In the controller to view B, I call performSegueWithIdentifier("unwind", sender: self)and see what is being called func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?), but nothing happens after that.

I have provided a custom name for deploying segue in Xcode and have the same setting between B and C views (with a different name to avoid conflicts) that works correctly.

Edit: The conversation is removed using the button or code, and the button flow works fine. I'm confused because the runtime can identify segue, otherwise it will throw an exception - so what could prevent it from starting? I went through the preparation method and does not block anything there.

Edit 2: I noticed that the difference between starting the decoupling between views A and B using the button and using the code is the destination VC. When passing through a button, the destination is view A, but through the code it is C. Why is this happening? The code flow is launched through the view C, where there is a button to return to viewing A, and this is just a series of gaps that exit the stack.

enter image description here

, , A C DI, B, , A.

+4
2

https://spin.atomicobject.com/2015/04/23/unwind-segue-set-destination/

, vc B, , B A " ".

override func canPerformUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject) -> Bool {
    return fromViewController is ViewC
}

segue B , C.

+1
-3

Source: https://habr.com/ru/post/1629540/


All Articles