Created
March 29, 2016 20:23
-
-
Save ramakser/aa7019e949cdab78da249266771f249f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITabBarController *)mainViewController { | |
return [TyphoonDefinition withClass:UITabBarController.class configuration:^(TyphoonDefinition * definition) { | |
[definition injectMethod:@selector(setViewControllers:animated:) parameters:^(TyphoonMethod * method) { | |
[method injectParameterWith:[self mainViewControllers]]; | |
[method injectParameterWith:@NO]; | |
}]; | |
}]; | |
} | |
- (NSArray *)mainViewControllers | |
{ | |
return [TyphoonDefinition withClass:[NSMutableArray class] configuration:^(TyphoonDefinition *definition) { | |
[definition injectMethod:@selector(addObject:) parameters:^(TyphoonMethod *method) { | |
[method injectParameterWith:[self navigationControllerWith:self.ordersViewController]]; | |
}]; | |
[definition injectMethod:@selector(addObject:) parameters:^(TyphoonMethod *method) { | |
[method injectParameterWith:[self navigationControllerWith:self.offersViewController]]; | |
}]; | |
}]; | |
} | |
- (UINavigationController *)navigationControllerWith:(UIViewController *)controller { | |
return [TyphoonDefinition withClass:UINavigationController.class configuration:^(TyphoonDefinition * definition) { | |
[definition injectProperty:@selector(viewControllers) with:@[ | |
controller | |
]]; | |
definition.scope = TyphoonScopePrototype; | |
}]; | |
} | |
- (TTOrdersViewController *)ordersViewController { | |
return [TyphoonDefinition withClass:TTOrdersViewController.class configuration:^(TyphoonDefinition * definition) { | |
//some injections | |
}]; | |
} | |
- (TTOffersViewController *)offersViewController { | |
return [TyphoonDefinition withClass:TTOffersViewController.class configuration:^(TyphoonDefinition * definition) { | |
//some injections | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment