Objection is a lightweight, dependency injection framework
"Dependency Injection" is a design pattern for object-oriented programming to reduce the coupling between code. is usually implemented based on an interface, which means that no new object is required, but the object is obtained through the associated controller. the Laravel of the 2013 's hottest PHP framework is typical.
The specific use is as follows:
1. First create
Protocol file
@protocol Pphomeviewcontrollerprotocol <NSObject>
@end
2. Initialization
+ (void) load{ jsobjectioninjector *injector = [jsobjection defaultinjector]; INJECTOR = injector? : [Jsobjection createinjector]; INJECTOR = [Injector withmodule:[[self alloc] init]]; [Jsobjection setdefaultinjector:injector];} -(void) configure{ [Self Bindclass:[homeviewcontroller class] Toprotocol: @protocol ( Pphomeviewcontrollerprotocol)];}
3. Get Objects
Uiviewcontroller <PPHomeViewControllerProtocol> *ONEVC = [[Jsobjection defaultinjector]getobject: @protocol ( Pphomeviewcontrollerprotocol)];
Reference: http://blog.jobbole.com/66929/
Objection to modular development of IOS projects