performSegueWithIdentifier has no segue with identifier

Swift 4:

Sometimes we must clean the build folder and then try again.

Worked for me after ctrl-dragging the new segue and giving it a name, then using it programatically as:

performSegue(withIdentifier: "goToMyNewViewController" , sender: self)

You haven't actually given that segue an identifier. unwindToHomeScreen is a function that you can call; what you're looking for is your segue identifier, which is set in Interface Builder like this:

Set an identifier

In this example, I have a button wired to the next view via Interface Builder like you describe ("Interface Builder") and a button that is wired to this IBAction in my view controller ("Programmatically"):

@IBAction func goToNextView(sender: UIButton!) {
    self.performSegueWithIdentifier:("go", sender: self)
}

In any case, what you're missing is the actual identifier, which can be set in the attributes of a segue created in Interface Builder.

Tags:

Ios

Xcode

Swift