When working with storyboards in Typhoon, if I do something like this in the assembly
- (id)myController
{
return [TyphoonDefinition withClass:[BigControll
Have you tried declaring the storyboard as a factory component? Here's an example:
//Create the factory definition
-(id)myStoryBoard
{
return [TyphoonDefinition withClass:[TyphoonStoryboard class] configuration:
^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle) parameters:
^(TyphoonInitializer* initializer) {
[initializer injectParameterWith:@"storyBoardName"];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}
definition.scope = TyphoonScopeSingleton; //Let's make this a singleton
}
}
//Create definitions that will be emitted by the factory
-(id)firstVc
{
return [TyphoonDefinition withFactory:[self myStoryBoard]
selector:@selector(instantiateViewControllerWithIdentifier:)
parameters:^(TyphoonMethod *factoryMethod) {
[factoryMethod injectParameterWith:@"viewControllerId"];
}];
You should now be able to resolve this component from the factory. The documentation for this feature is here.
Incidentally, I note that you're resolving you controller using the TyphoonComponentFactory interface, which is fine. But did you know that the TyphoonComponentFactory can pose as any of your assembly interfaces? So you can also resolve as follows:
UIViewController* viewController = [(MyAssemblyType*) factory firstVc];
. . . this is especially useful for the following:
Example:
@interface MyListViewController
//In the assembly we inject 'self'.
//We'll obtain the detail VC using the "domain specific" assembly interface.
//. . but when injecting self, it can be cast to TyphoonComponentFactory or any of your
//assembly interfaces
@property(nonatomic, strong, readonly) MyAssembly* assembly;
@end