4

how does addObserver: works under the hood ? Since Objective C can't overload operators...

Are class @properties, or object references stored implicitly in a NSDictionary, which can monitor value access ? Or how can cocoa observe values ?

And especially when we write the getter and setter of property by ourself, how does the observer notification happen?

Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179

1 Answers1

6

The KVO mechanism creates subclasses at runtime and overrides the observed setter methods. This excellent article of Mike Ash explains how it is implemented.

Nicolas Bachschmidt
  • 6,475
  • 2
  • 26
  • 36