After using the new API with the TyphoonAssemblyActivator
interface, I would like to instantiate a UIViewController
located within a UIStoryBoard
, but it misses the factory
instance.
How should I do this ?
TyphoonAssemblyActivator
is useful for bootstrapping Typhoon in a library or somewhere within a legacy application. For a fully-Typhoon powered application its better to use plist integration.
Just add the name of your TyphoonAssembly
classes in your app's plist file, and optionally inject your AppDelegate class. Having done this:
If for some reason you did want to create a TyphoonStoryboard manually you could create a definition for one in the assembly as:
- (UIStoryboard*)storyboard
{
return [TyphoonDefinition withClass:[TyphoonStoryboard class]
configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle:)
parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:@"StoryboardName"];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}];
}];
}