Re: NSArrayController Undo
Re: NSArrayController Undo
- Subject: Re: NSArrayController Undo
- From: Quincey Morris <email@hidden>
- Date: Fri, 14 May 2010 11:02:11 -0700
On May 14, 2010, at 10:44, Richard Somers wrote:
> I see what you are saying. The path I was following was a little different. Each model object has a 'selected' attribute or property. When the array controller selection is set, the model objects 'selected' property is also set. What I was trying to do was figure out how to get each model object's 'selected' property back into the array controller's selection.
Well, binding the array controller's selection indexes is the easy way. :)
> You are suggesting that I just use the array controller's selection, which is an index set, and just put that into Core Data. That would work for a transient property but not for an on disk persistent store. The index set of the array controller is based on an in-memory arrangement of model objects and could change and does change from one document opening to the next. But if I do not need persistence this might be the way to go.
You can easily write your own reversible transformer to convert between index sets and whatever you want the persistent representation to be. Two points to note:
1. This is somewhat more convenient now that you no longer have to register transformers manually on application startup. (The documentation used to be a bit unclear on this.)
2. Warning! Core Data runs custom transformers in the *opposite* direction from the standard one. (The documentation used to be a bit unclear on this.)
_______________________________________________
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