Closed driis closed 12 years ago
Looks like this feature ended up in some outdated branch (atomicobject:development
). Is is possible to pass dependencies into objection_initializer
in current version (1.3.1)?
It hasn't been integrated at this point. I want to update the implementation approach to it.
This pull requests adds support for initializers to be truly dependent on types registered with Objection. Currently, when using objection_initializer, one has to know the concrete dependency either when the type is registered, or when it is resolved. It would be nice to simply register the initializer one would like to use, and let it be up to Objection to resolve it's depencies when calling getObject; this is what this pull request adds.
You can now use objection_initializer like this:
The first dependency will then be resolved when calling getObject, instead of being specified when the type is registered. Of course this also works the other way around for getObjectWithArgs, using JSObjectionDependency here allows you to override a dependency with whatever is currently registered with Objection.
There are tests for this in InitializerSpecs.m. Most of the new feature is in JSObjectionUtils.m.
I think this would be a nice addition to the Objection framework, and hope you will accept it. If you should agree with the feature, but disagree with the style or way it is implemented, please tell me and I will try to improve ;-)