-
Notifications
You must be signed in to change notification settings - Fork 143
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
Feature brainstorm: Inject arguments on instantiateViewController
#61
Comments
Hi @oronbz Thanks for the suggestion 👍 - I agree this would be a logical extension for SwinjectStoryboard API. However, it currently does not exist, because |
Hey @jakubvano! Great to hear you agree with me, now let's try to think how to tackle this with a none to minimal effect on One way that not necessarily involves arguments, is adding another parameter to That way we can write a This is the least obtrusive solution that I can think of that doesn't involve touching core What do you think? Have any other suggestions or feedback? |
You can use my solution that gives you pass up to 3 arguments |
@webslesar Looking good! Why not make a pull request? |
In case people are still following along.. it doesn't appear like #62 is moving along. I've been using this to pass arguments to storyboard based VCs which requires no modification to swinject or swinject storyboard. https://gist.github.com/IanKeen/93e9bbf203f84407e7873044d765b164 |
Thanks @IanKeen I'll try that and let you know how it's working for us 👍 |
Hi,
I really love the feature of
Swinject
where I can add additional arguments when I callresolve
:Declaration:
Usage:
r.resolve(OfferSettingsViewModeling.self, argument: "Some Argument")
I wonder if we could implement a similar thing when instantiating view controllers from
SwinjectStoryBoard
:Something like:
func instantiateViewController<Arg1>(withIdentifier identifier: String, arg1: Arg1)
And use it like this:
and then I can catch it on
storyboardInitCompleted
like this:I think this would be really helpful for use cases where you want to instantiate a view controller with a given context, mostly relevant in master/detail stories, where the detail view controller's view model need to be instantiated with an identifier regarding the chosen detail on the master view controller.
What do you think?
The text was updated successfully, but these errors were encountered: