-
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
Object build by TyphoonFactoryProvider is not honoring <TyphoonComponentFactoryAware> #144
Comments
Ok, so as far as I understand, There are two cases here:
In case I cannot make it work, I propose relaxing the requisites a little bit: the use inside the block will be the one responsible for injecting the component factory in its object, accesing a property like I’m going to start working in the first one, and see how far I get for the second one. If anyone sees some problem or thinks I’m going off the rails, please comment. |
Types conforming TyphoonComponentFactoryAware passed as the return type for a factory generated from TyphoonFactoryProvider, will be now correctly injected with the component factory. This commit only works when using withProtocol:dependencies:returns:. Others will come in later commits. See appsquickly#144
Would be very useful to have the former case supported. In there latter case, where its the config block that explicitly spells out the dependencies, it does actually sound reasonable to ask the user to specify the factory injection with #131 (which I'll implement and push today). What do you think? |
…s!). This commit completes the previous one, making factories based on blocks also inject the factory when appropriate. The idea is using the already working implementation from the initializer closures: the block turns into the implementation of a hidden method, the real method gets intercepted by forwardInvocation, which gets redirected to the hidden method, and the return value gets injected with the component factory if needed. Tests added or updated for the new feature. See appsquickly#144
Well, there you go. Both Give it a look, a let me know if it covers your use case, and I will merge into master. |
👍 Very excellent. Let's merge it in. |
Types conforming TyphoonComponentFactoryAware passed as the return type for a factory generated from TyphoonFactoryProvider, will be now correctly injected with the component factory. This commit only works when using withProtocol:dependencies:returns:. Others will come in later commits. See appsquickly#144
…s!). This commit completes the previous one, making factories based on blocks also inject the factory when appropriate. The idea is using the already working implementation from the initializer closures: the block turns into the implementation of a hidden method, the real method gets intercepted by forwardInvocation, which gets redirected to the hidden method, and the return value gets injected with the component factory if needed. Tests added or updated for the new feature. See appsquickly#144
Done. I had a strange appearing and disappearing test failure with the cyclic dependency exceptions, but after doing a clean and rebuild they didn’t appear again. I don’t see how I might have introduced such a problem, but if someone sees the problem again, it might be a good thing to investigate if the tests are brittle. |
Re strange problems: Maybe it was some stale files . . I made a change today that caught an issue about circular deps in initializers - seems we're moving towards raising an exception for that. So I changed the test rules to assert an exception is raised. I did raise an issue to discuss further though. See it? (Typed comment on iPhone) |
No description provided.
The text was updated successfully, but these errors were encountered: