In a legacy application, where I'm gradually introducing Typhoon, if I want to instantiate an instance from Typhoon from a class that was not itself instantiated from Typhoon, I can place the following in my AppDelegate:
[self.assembly makeDefault];
And the definition for AppDelegate in my assembly:
- (AppDelegate *)appDelegate
{
return [TyphoonDefinition withClass:[PFAppDelegate class]
configuration:^(TyphoonDefinition *definition)
{
[definition injectProperty:@selector(assembly) with:self];
}];
}
Elsewhere I can do the following to get the instance of the assembly:
MyAssembly* assembly = [MyAssembly defaultAssembly];
This is ok, but suppose my application is composed by the following:
- Main project that contains various child projects.
- Main project has the pod dependency to Typhoon, assembly is written here and has the definition of objects to be injected in his child projects.
Because child projects do not know of the Main project I cannot #import the assembly and use:
MyAssembly* assembly = [MyAssembly defaultAssembly];
How should I proceed in this scenario?