Hi,
I am using a module to register dependencies. I have this one class, call it X, that I want the container to manage. It has a property, NSNumber, that I want to be injected
@property (nonatomic) NSNumber *showHideDecorationDuration;
And in the impl:
objection_requires_names((
@{@"SlideshowShowHideDecorationDuration": @"showHideDecorationDuration"}
))
Of course, in my app in a central location, I create a module and injector
_objectionModule = [JSObjectionModule new];
_injector = [JSObjection createInjector:_objectionModule];
I then pass this module _objectionModule, to another class. Note that I'm not subclassing module, as I don't see any requirement for this pattern in the code, the methods provided in the base class appear to suffice.
- (void)configureApplicationModule:(JSObjectionModule *)module {
[module bind:@(0.7) toClass:[NSNumber class] named:@"SlideshowShowHideDecorationDuration"];
}
As a result of this bind, inside the _objectionModule's _bindings there is now an entry for "NSNumber:SlideshowShowHideDecorationDuration" to JSObjectionBindingEntry * that holds an NSNumber instance equal to 0.7
Later, I reach the point where I want to instantiate X, so I do this:
[_injector getObject:originalClass
named:bindingName
initializer:@selector(initWithModule:)
argumentList:@[module]];
Inside this getObject:... method, eventually InjectDependenciesIntoProperties is reached. Here when it finds the property "showHideDecorationDuration", it asks the injector to find the object for that.
The injector goes to this method again:
- (id)getObject:(id)classOrProtocol named:(NSString*)name initializer:(SEL)selector argumentList:(NSArray *)argumentList
where it checks to see if the _context has an object for key "NSNumber:SlideshowShowHideDecorationDuration". However, the _context does not. It's only in the _bindings inside the module in that injector.
What am I missing?