Question

This question already has an answer here:

Is there any advantage to use KVO instead of the more "generic" (and to my opion more robust) feature of NSNotifications ?

Was it helpful?

Solution

I hate KVO with passion, mainly because it forces me to route all KVO notifications through a single handler. I use whatever else available if I have the choice. But KVO has the distinct advantage of being available for many of the classes in the standard library – if you want to observe property changes on some classes from the standard library, KVO might be your only option. There is one very interesting thread on Cocoa Builder about KVO and various observing and binding options.

(I should add that I only have gripes with KVO as a high-level observation interface. I think it’s very good as plumbing for other technologies, especially bindings.)

OTHER TIPS

In order to use NSNotifications todo something similar to KVO you would have to write custom boilerplate accessor methods for every property you wanted to observe.

This is both much less "generic" and much less robust than using KVO.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top