Type Method


Returns a set of key paths for properties whose values affect the value of the specified key.


+ (NSSet<NSString *> *)keyPathsForValuesAffectingValueForKey:(NSString *)key;



The key whose value is affected by the key paths.


When an observer for the key is registered with an instance of the receiving class, key-value observing itself automatically observes all of the key paths for the same instance, and sends change notifications for the key to the observer when the value for any of those key paths changes.

The default implementation of this method searches the receiving class for a method whose name matches the pattern +keyPathsForValuesAffecting<Key>, and returns the result of invoking that method if it is found. Any such method must return an NSSet. If no such method is found, an NSSet that is computed from information provided by previous invocations of the now-deprecated setKeys:triggerChangeNotificationsForDependentKey: method is returned, for backward binary compatibility.

You can override this method when the getter method of one of your properties computes a value to return using the values of other properties, including those that are located by key paths. Your override should typically call super and return a set that includes any members in the set that result from doing that (so as not to interfere with overrides of this method in superclasses).

See Also

Observing Customization

+ automaticallyNotifiesObserversForKey:

Returns a Boolean value that indicates whether the observed object supports automatic key-value observation for the given key.

+ setKeys:triggerChangeNotificationsForDependentKey:

Configures the observed object to post change notifications for a given property if any of the properties specified in a given array changes.


Returns a pointer that identifies information about all of the observers that are registered with the observed object.