1

As far as I can gather, there currently is no way to enumerate all the segues connected to a view controller in a storyboard. But if you know the IDs of the segues you are looking for, it is possible to just call performSegueWithIdentifier:sender: within a @try{}@catch{} block. But Swift does not have any exception handling mechanisms, and probably won't get them. Does this mean that "trying out" various segues is not possible using Swift, or did I miss something in the docs?

Edit: This method is what I found to allow the user of reusable components to use either storyboards or adding view controllers programmatically, or a mixture of both. So the segues are view controller container content segues, like the ones UISplitViewController uses.

Kolja
  • 1,197
  • 9
  • 17
  • I never used `@try{}@catch{}` in iOS i didnt find a reason to use that. You can go ahead with out that – Anil Varghese Aug 14 '14 at 12:45
  • @Anil I usually wouldn't either. But do you know of a way to implement the functionality I described without them? – Kolja Aug 14 '14 at 12:47
  • What you are trying to do. I didnt understand – Anil Varghese Aug 14 '14 at 12:58
  • Given a storyboard containing my custom view controller container, there may be zero, one or two segues with predefined identifiers connected to it. I want to find out which ones exist. Since I know their IDs I can try to perform them, but this raises exceptions if they don't exist. In ObjC I can catch those, but in Swift I can't. And I also can not get a list of the segues (there's no API for that). So how do I know which ones exist without crashing? – Kolja Aug 14 '14 at 13:01
  • Did you need this? How to check if a view controller can perform a segue: http://stackoverflow.com/questions/9626469/how-to-check-if-a-view-controller-can-perform-a-segue – Stefan Jun 13 '15 at 10:33

0 Answers0