-
Notifications
You must be signed in to change notification settings - Fork 268
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
Dependency injection for objects not emmitted from component factory? #103
Comments
We need something that's kind of the other way around. Using Storyboards (via this technique), UIStoryboard instantiates an instance of our HomeScreenViewController and Typhoon injects its properties. But we have other objects in our Typhoon assemblies that need access to the |
The other way around is pretty simple actually. . . We can just use the UIStoryBoard as a factory for emitting other objects. . I will set up an example in the next 24 hours. |
It's a little trickier than you may think: we've solved it by introducing a Typhoon-managed proxy object that |
Sounds simple enough to me. . want to contribute that back? |
It's literally that line of code wrapped up in a class. I'll write it up as a gist to illustrate the technique if you like. It still feels like a nasty workaround to me though. |
Sure that would be helpful. . . meanwhile are you asking about having StoryBoard produced objects to participate as components in the Typhoon assembly? I have some other ideas there. . . |
Gistified. And yeah, that's what I'm interested in. (It may turn out to be that I'm wanting to do something that I shouldn't want to do, too...) |
Closing in favor of more clearly defined #206 |
I'm thinking of supporting something like Spring's "@configurable" annotation that allows dependency injection of an object that gets instantiated outside of the Typhoon component factory?
This is useful in the following kinds of scenarios:
Of course there are always workarounds - such as providing an injector on DAO object or using the injectWithDependencies hook after resolving from a story board. . . but would this be a nice feature?
I'm thinking of a global:
[MyModelOrControllerClass configureWithFactory:someFactoryOrAssembly];
and from their on in, any instantiation of this class would have dependencies injected. . . I guess these would have to use property injection.
Thoughts? Worth it?
The text was updated successfully, but these errors were encountered: