Created
March 31, 2014 21:21
-
-
Save snown/9902652 to your computer and use it in GitHub Desktop.
Non functional sample code
This file contains 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
@implementation Interceptor | |
+ (IMP)instanceMethodForSelector:(SEL)aSelector { | |
NSLog(@"instanceMethodForSelector:"); | |
IMP result = [super instanceMethodForSelector:aSelector]; | |
NSLog(@"+[super instanceMethodForSelector:%@] = %p", NSStringFromSelector(aSelector), result); | |
return result; | |
} | |
+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector { | |
NSLog(@"instanceMethodSignatureForSelector:"); | |
NSMethodSignature *result = [super instanceMethodSignatureForSelector:aSelector]; | |
NSLog(@"+[super instanceMethodSignatureForSelector:%@] = %@", NSStringFromSelector(aSelector), result); | |
return result; | |
} | |
+ (BOOL)instancesRespondToSelector:(SEL)aSelector { | |
NSLog(@"instancesRespondToSelector:"); | |
BOOL result = [super instancesRespondToSelector:aSelector]; | |
NSLog(@"+[super instancesRespondToSelector:%@] = %@", NSStringFromSelector(aSelector), @(result)); | |
return result; | |
} | |
+ (BOOL)resolveClassMethod:(SEL)sel { | |
NSLog(@"resolveClassMethod:"); | |
BOOL result = [super resolveClassMethod:sel]; | |
NSLog(@"+[super resolveClassMethod:%@] = %@", NSStringFromSelector(sel), @(result)); | |
return result; | |
} | |
+ (BOOL)resolveInstanceMethod:(SEL)sel { | |
NSLog(@"resolveInstanceMethod:"); | |
BOOL result = [super resolveInstanceMethod:sel]; | |
NSLog(@"+[super resolveInstanceMethod:%@] = %@", NSStringFromSelector(sel), @(result)); | |
return result; | |
} | |
- (id)forwardingTargetForSelector:(SEL)aSelector { | |
NSLog(@"forwardingTargetForSelector:"); | |
if (self.next) { | |
return self.next; | |
} else { | |
id superResult = [super forwardingTargetForSelector:aSelector]; | |
NSLog(@"Super Forwarding Target: %@", superResult); | |
return superResult; | |
} | |
} | |
- (void)forwardInvocation:(NSInvocation *)anInvocation { | |
NSLog(@"forwardInvocation:"); | |
[super forwardInvocation:anInvocation]; | |
} | |
- (BOOL)respondsToSelector:(SEL)aSelector { | |
NSLog(@"respondsToSelector:"); | |
BOOL result = [super respondsToSelector:aSelector]; | |
NSLog(@"[super respondsToSelector:%@] = %@", NSStringFromSelector(aSelector), @(result)); | |
return result; | |
} | |
- (IMP)methodForSelector:(SEL)aSelector { | |
NSLog(@"methodForSelector:"); | |
IMP result = [super methodForSelector:aSelector]; | |
NSLog(@"[super methodForSelector:%@] = %p", NSStringFromSelector(aSelector), result); | |
return result; | |
} | |
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { | |
NSLog(@"methodSignatureForSelector:"); | |
NSMethodSignature *result = [super methodSignatureForSelector:aSelector]; | |
NSLog(@"[super methodSignatureForSelector:%@] = %@", NSStringFromSelector(aSelector), result); | |
return result; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment