Unwind Segue in Xcode 6 Beta 4

I am trying to add unwinding to a quick application in Xcode 6, and the release notes for the first three beta versions have announced that it is not supported. However, in beta 4, this error is no longer present. I heard that people were able to get it to work, but I didn’t have such luck. So my question is this: how should I try to see if unind segue mode will work in my application? What should i try? I am using UIBarButtonItem to run segue.

So far, I have put this code in the destination manager .swift file:

@IBAction func unwindToSegue(segue:UIStoryboardSegue) {} 

Using this code, I was able to connect the panel button to the function by dragging the control from the panel to the exit icon, and then clicking the unwindToSegue method. This part worked, but the code does not run even when I set a breakpoint inside a function that it did not call.

+8
swift xcode6 segue
source share
4 answers

You need to put your unwindToSegue function in the original ViewController (i.e. the ViewController you are trying to return to).

Another thing you can try is to call the segue program call. First, exit from the view controller icon to the exit icon (all three icons are located at the top of the view controller in Interface Builder). Give this name, for example, "goBackHome". Then swipe your button to call this @IBAction :

 @IBAction func headHome() { println("Button seen. Trigging exit segue manually...") self.performSegueWithIdentifier("goBackHome", sender: self) } 
+21
source share

My problem was that I switched to standard view controllers (VCs) from a custom VC container, but tried to cross out the original navigation bar. Research forums have shown that spinning segues will “pop out” the new “VC protocols” from the stack and allow me to return to the original VC protocols unchanged.

I dragged the button to the new VC, first dragged it to the fast file to create the “back2main” action, changing it as shown below, THEN dragged the button to the exit icon at the top of the new VC that generates the “unwind segment”.

 @IBAction func back2main(segue: UIStoryboardSegue) { dismissViewControllerAnimated(true, completion: nil) } 
+1
source share

It works with Xcode 6 Beta 4. Remove @objc (class name) from the class definition and delete the (workaround) .h file.

I had a similar effect yesterday, one of my buttons in my Viewcontroller did not cause a segue reversal.

Try it: Drop the new UIButton on the view controller and leave it as it is. Do not change anything to ensure that there are no side effects. Then connect this button to your unwinding and try if it works.

0
source share

I had the same problem. the unwind function was shown when I selected the exit button, and it was connected, and that’s all, but when the button was pressed nothing happened.

After some confusion, I realized that this was because I chose Segue to switch from one View controller to another.

The problem is that the view in which I wanted it to return had more than a few different navigation components that were removed after the "child" view was displayed. I solved it by changing it from Show (or show in detail) to popover.

Go to the section, select the Attributes inspector and from there you can change the session.

0
source share

All Articles