If I store an observer like this:
let observer: NSKeyValueObservation = foo.observe(\.value, options: [.new]) { (foo, change) in
print(change.newValue)
}
How do I remove/disable/cleanup observer
once I no longer need it?
My foo
instance does not have any remove
-like method that receives an NSKeyValueObservation
instance, the observer
itself doesn't have any remove
-like either.
invalidate
on the observer to unregister it – Quartering