New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle viewControllers loaded from storyboard #13
Comments
Hi again Yes, I'm not using storyboard at all, so was thinking to handle this later. However, having a way to instantiate a controller might be a good idea, to handle load from nib things for example. I was hoping some day to add it as well to the sugar syntax |
I understand your point about segues. We can trigger them, but they need an identifier to be triggered, and there is no convention on naming them, so the handler will have to know each identifier for a route. Well I think I'll stick to my first solution to be able to update my app soon, and I'll try to come up with a solution for segues, xibs, etc. when I have some time to think about it. I'll close this issue and open a new one later with a more generic title to include both segues and xibs unless you already found a way to do it. Cheers. |
@ipodishima Would you please consider reopening this feature request? I think that the ability to load view controllers from storyboards is important. And having that ability will allow many other developers to use your already great library. For my app, I can only use WAAppRouting to set up and show a root view controller. All my detail view controllers are loaded from a storyboard, and the app crashes if I try to route to a detail view controller because the IBOutlets are not initialized. |
I agree with @ndmeiri. Storyboard/Xib support is the only thing stopping me from using this this library so I hope you would reconsider. I agree with @enfoiro about adding an optional method in RouterTargetControllerProtocol for instantiating a view controller via storyboard. When it comes to segues, a view controller can be instantiated from the storyboard without having to trigger any segues. It can exist independently from it's source segue and you can still trigger any additional segues coming from that view controller as long as it's loaded via UIStoryboard convenience methods -instantiateInitialViewController and -instantiateViewControllerWithIdentifier. Any context (I'm assuming any kind of state) provided by transitioning from an original segue can be provided from -reloadAppFromLinkRefresh. |
Hello,
The routeHandler does it's job very well, but the only problem I can see is that it does always instantiate view controllers with alloc, init.
When you have storyboards, you have to instantiate your view controllers through an instance of the storyboard, in order to have proper initialisation of IBOutlets, IBAction and all other custom configuration stuff done in the storyboard.
In my case, WAAppRouting doesn't work with most of my view controllers, but I don't want to implement another routeHandler because everything else does fit to my use-case.
I suggest to add an optional method in the routeTargetControllerProtocol where you can allow the controller to instantiate itself, from storyboard, xib, etc.
If the method is not present, we do the classic alloc, init.
I already have an implementation working, I could submit a PR if you like.
Thanks.
The text was updated successfully, but these errors were encountered: