When observing a value on an object using addObserver:forKeyPath:options:context:, eventually you\'ll want to call removeObserver:forKeyPath: on th
I underestand this an objective-c question. But since lots of people use Swift/objective-c together, I thought I point out the advantage of the Swift4 new API over older versions of KVO:
If you do addObserver multiple times for KVO, then for each change you’ll get the observeValue as many as the current number of times you’ve added yourself as the observer.
removeObserver as many times as you added.The Swift4 observe is far smarter and swiftier!
invalidate of the token is enough.invalidating it before beginning to observer or more times that that you’ve done observe will not result in a crashSo to specifically answer your question, if you use the new Swift4 KVO, you don't need to care about it. Just call invalidate and you're good. But if you're using the older API then refer to Nikolai's answer