func addObserver (NSObject, forKeyPath : String, options: NSKeyValueObservingOptions, context: UnsafeMutableRawPointer?)
func removeObserver (NSObject, forKeyPath : String)
Availability
Technology
func removeObserver(_ observer: NSObject
,
forKeyPath keyPath: String
,
context: UnsafeMutableRawPointer
?)
observer
The object to remove as an observer. オブザーバとして取り除くことになるオブジェクト。
keyPath
A key-path, relative to the observed object, for which observer
is registered to receive KVO change notifications.
context
Arbitrary data that more specifically identifies the observer to be removed.
Examining the value in context
you are able to determine precisely which add
invocation was used to create the observation relationship. When the same observer is registered for the same key-path multiple times, but with different context pointers, an application can determine specifically which object to stop observing. It is an error to call remove
if the object has not been registered as an observer.
Be sure to invoke this method (or remove
) before any object specified in add
is deallocated.
func addObserver (NSObject, forKeyPath : String, options: NSKeyValueObservingOptions, context: UnsafeMutableRawPointer?)
func removeObserver (NSObject, forKeyPath : String)