Segue Not Appearing. No error.

I am trying to implement a segue programmatically.

My story board looks like this:

https://i.stack.imgur.com/VFkKx.png

The first segue between the first two screens is done by connecting the Login button to the next screen (so not completely programmatically), and it works fine.

The issue is with the "secondSegue", which I tried doing programmatically. It simply does not work and there is no error message appearing.

I connected the 'Load this Screen' button to the following action in the Second Screen's view controller:

@IBAction func openThirdScreen(_ sender: Any) {

     performSegue(withIdentifier: "secondSegue", sender: nil)

}

But the screen isn't opening and there is no error.

All the proper IBOutlets seem connected so I don't know what the issue could be.

I put a print statement in openThirdScreen(), and it prints, but a print statement in the third screen's View Controller's viewDidLoad() does not print, even though I made sure the third screen was connected to a view controller.

I had overridden

performSegue()
earlier in order to do more with the segue but it was not working so I removed it for simplicity.

Please let me know what I messed up. Sorry if this is a stupid question, I'm very new to XCode and I couldn't find anyone online with the same issue.

Let me know if there are more screenshots that are necessary to answer my question.

Replies

1.check you secondViewController is associated

2.add breakpoint in the button action

3.see if this function is executed

Hope to help you.

Did you check that the identifier of the secondSegue is exactly secondSegue ? It seems OK in your png


Take care, it is case sensitive.


How did you create the secondSegue from 2nd view to 3rd View ?


Usually, you control drag from the view controller (either its icon at the top of the view) or from it's name in object navigator to the other view Controller.


Also do an option clean of the build (option and select Product -> Clean Build Folder