I’m trying to update a custom property in an NSManagedObject whenever an item that it has a to-many relation to changes. I’ve overridden the following methods as prescribed by apple:
- (void)addDevicesObject:(Device *)value;
- (void)removeDevicesObject:(Device *)value;
- (void)addDevices:(NSSet *)value;
- (void)removeDevices:(NSSet *)value;
and inside the implementation I add or remove observers on the changed objects. The problem is my override methods are not called when my bindings based UI makes changes to the data. How should I go about doing this?
If the custom property is calculated when it is asked for, use +keyPathsForValuesAffectingValueForKey: to trigger update notifications when devices is changed.
If you want to perform calculations when devices is changed only, then use KVO to get notified when it is changed.