1

I'm a bit stumped by the workaround for unwinding a segue here: Xcode 6 Storyboard Unwind Segue with Swift Not Connecting to Exit

The segue is not firing yet I believe I'm implemeting it as outlined in the workaround:

1) The View Controller header:

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class DetailViewController;

@interface DetailViewController : UIViewController
- (IBAction) unwindToMaster:(UIStoryboardSegue *) segue;
@end

2) the Controller in Swift:

@objc(DetailViewController)class DetailViewController: UIViewController, UISplitViewControllerDelegate {

    @IBOutlet var detailDescriptionLabel: UILabel
    var masterPopoverController: UIPopoverController? = nil

    @IBOutlet var itemButton: UIBarButtonItem

    @IBAction func unwindToMaster(segue:UIStoryboardSegue) {
        NSLog("unwind baby")
    }
[...]
}

3) The link in the storyboard (as XML):

 <barButtonItem key="rightBarButtonItem" title="Item" id="5Nk-ZI-b7r">
                            <connections>
                                <segue destination="aIR-Or-dY2" kind="unwind" unwindAction="unwindToMaster:" id="aWo-Uk-qUQ"/>
                            </connections>
                        </barButtonItem>

4) How I reset the custom class:

I go to the custom class side page, I delete whatever is in the "Class" text field. It defaults to UIViewController. I save, then I click on the dropdown and select DetailViewController.

The segue is not firing i.e. it is clearly not properly linked to the "item" button but I'm stumped as to what the cause is.

I did implement solutions outlined in the link above and in this link:Workaround for swift unwinding

Of course I may have done it wrong and would appreciate some guidance.

Community
  • 1
  • 1
Laurent
  • 1,554
  • 19
  • 42
  • 1
    Have you updated to Xcode 6 Beta 4? It's supposed to have fixed the issue that required the workaround in the first place, so you may not need to use the workaround at all. – Kamaros Jul 24 '14 at 17:05
  • You know I didn;'t know v4 was out. I checked 3 days ago though. I'll download it BUT I'm thinking this is an opportunity to learn about mixing Objc and Swift - and since I'm reproducing the steps from the valid answers above, I'd still like to understand what I'm doing wrong. Make sense? – Laurent Jul 24 '14 at 19:04
  • 1
    As mentioned in the links that you posted, others have had issues with the workaround as well, with it working for some, requiring Xcode restarts for others, and still failing for the rest. Thus, it could be that you aren't doing anything wrong, and that the issue is just with Xcode or iOS or Swift being in beta. – Kamaros Jul 24 '14 at 19:14
  • I understand. Will upgrade. If you want to put your comment as an answer - I think the clarity re: v4 deserves an upvote. – Laurent Jul 24 '14 at 19:16

1 Answers1

1

Xcode 6 Beta 4 fixes the issue where unwind segues cannot find functions in Swift classes, so it isn't necessary to implement this workaround any longer.

Kamaros
  • 4,536
  • 1
  • 24
  • 39