Last active
August 18, 2018 12:38
-
-
Save sTinGe/7697211126f295290901435078405e41 to your computer and use it in GitHub Desktop.
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
@interface NSObject(NSKeyValueObserverRegistration) | |
/* Register or deregister as an observer of the value at a key path relative to the receiver. | |
The options determine what is included in observer notifications and when they're sent, as described above, | |
and the context is passed in observer notifications as described above. You should use | |
-removeObserver:forKeyPath:context: instead of -removeObserver:forKeyPath: whenever possible because it allows | |
you to more precisely specify your intent. When the same observer is registered for the same key path multiple times, | |
but with different context pointers each time, -removeObserver:forKeyPath: has to guess at the context pointer when | |
deciding what exactly to remove, and it can guess wrong. | |
*/ | |
- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(nullable void *)context; | |
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(nullable void *)context API_AVAILABLE(macos(10.7), ios(5.0), watchos(2.0), tvos(9.0)); | |
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment