Skip to content

Instantly share code, notes, and snippets.

@robbywalker
Last active December 11, 2015 05:18
Show Gist options
  • Save robbywalker/4550700 to your computer and use it in GitHub Desktop.
Save robbywalker/4550700 to your computer and use it in GitHub Desktop.
Simplified version of hookshot's forwardInvocation
- (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