Last active
May 16, 2016 13:01
-
-
Save craigmarvelley/95c938ee9ebddf0ca31cb4934ba8dc66 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
@implementation MyViewController | |
+ (BSInitializer *)bsInitializer { | |
return [BSInitializer initializerWithClass:self | |
selector:@selector(initWithApi:) | |
argumentKeys:@"myApi", nil]; | |
} | |
- (instancetype)initWithApi:(MyApi *)myApi { | |
... | |
} | |
@end | |
@interface MyBlindsideModule : NSObject<BSModule> | |
@end | |
@implementation MyBlindsideModule | |
- (void)configure:(id<BSBinder>) binder { | |
MyApi *apiInstance = [[MyApi alloc] initWithEndpoint:@"http://api.mycompany.com"]; | |
[binder bind:@"myApi" toInstance:apiInstance]; | |
} | |
@end | |
MyBlindsideModule *module = [[MyBlindsideModule alloc] init]; | |
id<BSInjector> injector = [Blindside injectorWithModule:module]; | |
UIViewController *rootViewController = [injector getInstance:[MyViewController class]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment