I have an iOS App with DI (Typhoon). In the Assembly I wrote this:
- (AvPlayerManager *)playerManager {
return [TyphoonDefinition withClass:[AvPlayerManager class]
configuration:^(TyphoonDefinition *definition)
{
definition.scope = TyphoonScopeSingleton;
}]; }
I can use this AvPlayerManager class in a ViewControllerA.h with auto injection:@property (nonatomic, weak) InjectedClass(AvPlayerManager) playerManager;
I have a collectionView and I want to use the playerManager in the cells.
But If I try with the injectedClass macro the property will be nil.
My UI:
viewControllerA -> collectionView -> collectionViewCell
How can I use this singleton instance in the collectionViewCell.m?
If I understand your question correctly, you would like to declare you injected dependencies privately in the implementation (.m) rather than in the header?
The way to do this is to use a class extension inside the implementation file, for example:
MyFile.m
By the way, if you're using Swift in the future you might like to check out Typhoon's Swift successor, which is called pilgrim.ph.
If I understood your question correctly great, otherwise could you please clarify.