Closed alexgarbarev closed 8 years ago
👍
Fixed. Now if someone want's to perform callback after all other injections (on built graph) occurs, new method on TyphoonDefinition available:
- (void)performAfterAllInjections:(SEL)sel;
This method has no arguments by design. Because it happens when all injections done, and we can't perform other injections here for consistency reason (and to prevent infinity recursion :-P )
I also changed order of typhoonDidInject and typhoonSetFactory methods. Now they also called at the end.
When we have circular references, performAfterInjections (or typhoonDidInject) called too early, when parents properties are not injected yet.
Example: object1 has properties propertyA and object1
object2 has property object1
while we creating object1, it creates object2 and points back on object1 by property reference, this is fine. But problem happens we access object.propertyA from object2 didInject method.
Basically didInject called when all dependencies injected into current object. It should be called only after all injections performed on his parents..
I think I'll do some callback block for that..