Last active
December 11, 2015 05:18
-
-
Save robbywalker/4550700 to your computer and use it in GitHub Desktop.
Simplified version of hookshot's forwardInvocation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)forwardInvocation:(NSInvocation *)inv { | |
Class targetClass = [self class]; | |
SEL selector = inv.selector; | |
runCallbacks(beforeBlocks, self, targetClass, selector); | |
@try { | |
IMP imp = method_getImplementation(class_getInstanceMethod(targetClass, selector)); | |
// This is a private method and must not make it's way to production code!! | |
[inv invokeUsingIMP:imp]; | |
} @finally { | |
runCallbacks(afterBlocks, self, targetClass, selector); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment