Re: Core Data, to-many relationships, and object graph consistency
Re: Core Data, to-many relationships, and object graph consistency
- Subject: Re: Core Data, to-many relationships, and object graph consistency
- From: Sebastian Celis <email@hidden>
- Date: Mon, 15 Jun 2009 14:59:08 -0500
On Mon, Jun 15, 2009 at 12:58 PM, Quincey
Morris<email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden
References: | |
| >Core Data, to-many relationships, and object graph consistency (From: Sebastian Celis <email@hidden>) |
| >Re: Core Data, to-many relationships, and object graph consistency (From: Quincey Morris <email@hidden>) |
| >Re: Core Data, to-many relationships, and object graph consistency (From: Sebastian Celis <email@hidden>) |
| >Re: Core Data, to-many relationships, and object graph consistency (From: Sebastian Celis <email@hidden>) |
| >Re: Core Data, to-many relationships, and object graph consistency (From: Quincey Morris <email@hidden>) |