Dmytrii G.
Dmytrii G.

Reputation: 547

How get access to existed segue from storyboard by identifier in code?

I have a segue with identifier (for example "SomeSegue") and need to get a access to this segue in code like this:

let mySegue = ...

How to do this?

PageVC as containerView in VC, with segue(embed)

Upvotes: 1

Views: 195

Answers (1)

Scott Thompson
Scott Thompson

Reputation: 23701

It really seems that you are running into the XY problem (http://xyproblem.info). There is not a good reason to get ahold of the Segue object itself. You might wish to use the identifier to perform the Segue though.

If you need to manually perform a segue you can use the method performSegue(withIdentifier:sender:) as documented here:

https://developer.apple.com/documentation/appkit/nssegueperforming/1409583-performsegue

Read the documentation in the "Discussion" section of that page carefully.

Upvotes: 1

Related Questions