Created
July 12, 2011 20:56
-
-
Save tolmasky/1078964 to your computer and use it in GitHub Desktop.
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
| @interface _KeyPathObserver : NSObject | |
| @end | |
| @implementation NSObject (Additions) | |
| - (void)performSelector:(SEL)aSelector forChangesInKeyPath:(NSString *)aKeyPath | |
| { | |
| [self addObserver:(id)[_KeyPathObserver class] forKeyPath:aKeyPath options:NSKeyValueObservingOptionNew context:aSelector]; | |
| } | |
| @end | |
| @implementation _KeyPathObserver | |
| + (void)observeValueForKeyPath:(NSString *)aKeyPath ofObject:(id)anObject change:(NSDictionary *)aChange context:(void *)aContext | |
| { | |
| [anObject performSelector:(SEL)aContext]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment