Segues uses any kind of view controller for their methods – initWithIdentifier:source:destination: This is not a segue that creates a destination view controller, but a storyboard. From the docs :
Usually, view controllers in a storyboard are created and automatically created in response to actions defined in the storyboard itself.
So, you have several options:
Subclass of UIStoryboard. Probably a bad idea. The open interface for UIStoryboard has only three methods; “actions defined within the storyboard itself” are not publicly available, and I don’t think that there is enough information to allow you to do the job right.
Make the destination controller single. Also a bad idea. Besides the general bad things that singlets bring with them , you don’t need to keep a view controller that has no views and no child view controllers. And making your class controller class one single just to trick UIStoryboard into using a specific instance of your view controller class seems pretty annoying.
Subclass of UIStoryboardSegue. . If you create your own segments, you can do what you like in – initWithIdentifier:source:destination: including ignoring the provided view controller and using the one you want. This still looks like working with a wireframe, and it's usually a bad plan, but if you absolutely must use a specific instance of your destination view controller, this seems like the best way.
Go with the stream. The best way. Think about the reason you are hoping to migrate to an existing view controller. Consider if there are better ways to achieve what you want without having to undermine the structure. For example, do you want to use an existing view controller since it already has a certain state? It might be better to maintain this state in your model rather than in the view controller.
source share