Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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