TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A simple dependency injection framework for objective c, written while traveling in a train!
Add an Ivar to your Class file with the IOC prefix and the service you want to inject. There are three injection flavours:
// .m
@interface MyClass () {
MyService* _ioc_MyService; //will create an instance of MyService.
id<MyProtocol> _ioc_MyProtocol //will create an instance of the first class conforming to MyProtocol.
NSArray* _ioc_MyProtocol //will return an array containing instances of all classes conforming to MyProtocol
}
Use the service in your class. It is already initialized!
Copy the src folder to your project directory
-OR-
pod 'Train'
In your AppDelegate, add the following:
#import "AutoInjector.h"
+(void)initialize {
[AutoInjector autoInjectIoc];
}
Thats its, your all set and ready to go.
Check it out!