Would varying the output of +(NSSet*) keyPathsForValuesAffecting<Key>
at runtime affect the dependant keys? In other words, how often/when is this method called?
the docs give me the indication that keyPathsForValuesAffecting<Key>
is only ever called when setting up the observation.
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.
In many cases you could probably use KVO itself to inform your observers that keyPathsForValuesAffecting<Key>
has changed. manual willChangeValueForKey
and didChangeValueForKey
notifications for some custom key would be one way of dealing with dynamically changing keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With