enum RandomTips { case PerformSegue

Table of Contents

case PerformSegue

I’ve always found connecting Interface Builder to code slightly clunky. To be fair, I don’t have any experience with any other, competing gui schemes, so maybe it’s a great system, relatively, or not.

One of the clunky feelings for me was the segue. I hate stringly typed values. And this is one of them. Despite that, I knew how to "intercept" the segue and set values on destinations via prepare(for segue) and I also knew how to move between view controllers programmatically, but I wasn’t entirely sure what was going on behind the scenes that called the segue in the first place. Turns out it’s simple.

@IBAction func myButtonLicked(_ sender: UIButton) {
    performSegue(withIdentifier: "MySegueID", sender: self)
}

Now I can be more consistent in my projects, either being all programmatic or through Interface Builder!

Leave a Reply