Prepare for Segue in Swift

ios, swift, uistoryboard, uistoryboardsegue

Solution

This seems to be due to a problem in the `UITableViewController` subclass template. It comes with a version of the `prepareForSegue` method that would require you to unwrap the segue.

Replace your current `prepareForSegue` function with:

override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
    if (segue.identifier == "Load View") {
        // pass data to next view
    }
}

This version implicitly unwraps the parameters, so you should be fine.

Problem

I'm facing the error message: ``` "UIStoryboardSegue does not have a member named 'identifier'" ``` Here's the code causing the error ``` if (segue.identifier == "Load View") { // pass data to next view } ``` On Obj-C it's fine using like this: ``` if ([segue.identifier isEqualToString:@"Load View"]) { // pass data to next view } ``` What am I doing wrong?

Original source