2009/9/15 Kyle Sluder <kyle.slu...@gmail.com>:
> If the only reason you want this is so that observers of calculatedBalance
> are notified when transactions changes (and therefore calculatedBalance),
> implement -keyPathsAffectingCalculatedBalance: to return a set that includes
> @"transactions".


That was my original implementation but unless I was doing something
wrong it only updates when the transactions relationship changes (i.e.
add or remove a transaction). I need that behaviour but I also need it
to update if an individual transaction's balance is changed.

The FAQ and KVO programming guide
(http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdFAQ.html
and 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html)
both have the same info and point me to observing either every child
or the managed object context (as per my original post) but the devil
is in the detail.

Although, as I write this I've just had a thought that I'm probably
over-complicating things... Instead of trying to observe every child
by monitoring the to-many transactions relationship perhaps I can
simply flip the problem around. It should be quite simple to add the
parent account as an observer in the transaction implementation (and
then if the account relationship changes just remove the old parent as
an observer and add the new one). I'll try that approach and report
back. Apologies for wasting people's time if that's what I should have
been doing all along!

Matt
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to