Skip to content

Instantly share code, notes, and snippets.

@craigmarvelley
Last active May 16, 2016 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmarvelley/95c938ee9ebddf0ca31cb4934ba8dc66 to your computer and use it in GitHub Desktop.
Save craigmarvelley/95c938ee9ebddf0ca31cb4934ba8dc66 to your computer and use it in GitHub Desktop.
@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