Search code examples
objective-ckey-value-observing

What is the purpose of NSKeyValueChangeSetting


In my observeValueForKeyPath:ofObject:change:context: method I have a switch with these cases:

case NSKeyValueChangeReplacement: /* replace an existing row */
case NSKeyValueChangeInsertion: /* insert a new row */
case NSKeyValueChangeRemoval: /* remove an existing row */

So far so good.

I also have to deal with NSKeyValueChangeSetting, but I dunno what to code.

case NSKeyValueChangeSetting: /* what about this one? */

So what is its purpose?


Solution

  • From the docs:

    Indicates that the value of the observed key path was set to a new value. This change can occur when observing an attribute of an object, as well as properties that specify to-one and to-many relationships.

    Basically this is a plain old "value changed for key"-style "notification", so to say.