i'm trying to instantiateInitial viewControllers manually and stuck with next thing.
This is working:
-(TyphoonStoryboard *)storyboard {
return [TyphoonDefinition withClass:[TyphoonStoryboard class] configuration:^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:@"Diary"];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
-(LADiaryMainViewController *)mainViewController {
return [TyphoonDefinition withFactory:[self storyboard] selector:@selector(instantiateInitialViewController)];
}
and this one is not working:
-(TyphoonStoryboard *)storyboardWithName:(NSString *)name {
return [TyphoonDefinition withClass:[TyphoonStoryboard class] configuration:^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:name];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}];
}];
}
-(LADiaryMainViewController *)mainViewController {
return [TyphoonDefinition withFactory:[self storyboardWithName:@"Diary"] selector:@selector(instantiateInitialViewController)];
}
Second way is crashes with: [__NSArrayM insertObject:atIndex:]: object cannot be nil
Oops.. Sorry,
factory definition
with runtime argument was not supported in Typhoon. But.. We've added that feature for you!Check Typhoon
3.1.9
version, your code should work fine now.