On Mon, Jun 15, 2009 at 12:58 PM, Quincey
Morris<quinceymor...@earthlink.net> wrote:
>
> If the comma-separated list is just for display in the user interface, you
> could generate it on the fly. Use 'keyPathsForValuesAffectingTagList' (or
> whatever) to ensure that the proper KVO notifications get sent when the
> underlying bookTag objects change.
>
> If you really want to store the comma-separated list, you can write your own
> set accessor overrides (addTagsObject, removeTagsObject, addTags,
> removeTags) and rebuild the string in the accessors. The only trick here
> (apart from following the documented pattern for writing the accessors) is
> to realize that the accessors are also called at undo time, so accessors
> with a side effect of updating a different property can be problematical
> unless you're careful.

Thanks for all of your help. For now I think I will stop caching the
comma-separated list. I was also caching a sorted array of the tags,
but I think I can just compute those whenever they are requested,
which should not be that often, anyway. If I run into a performance
issue with this code later, I can look at it then. Just seems strange
that I can't have my managed object observe itself for changes to a
particular attribute / relationship.

- Sebastian
_______________________________________________

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