Re: NSArrayController - error inserting object at arranged object index N
Re: NSArrayController - error inserting object at arranged object index N
- Subject: Re: NSArrayController - error inserting object at arranged object index N
- From: Quincey Morris <email@hidden>
- Date: Thu, 23 Jun 2016 15:03:39 -0700
- Feedback-id: 167118m:167118agrif8a:167118sqZWfVPZxk:SMTPCORP
On Jun 23, 2016, at 13:39 , Jonathan Mitchell <email@hidden> wrote:
>
> Do you mean something like this?
>
> NSMutableArray *proxy = [NSArrayController mutableArrayValueForKey:@"content"];
That wasn’t what I had in mind. I meant that you would make the array a property of a real model object, and update *that* property, without referring to the array controller directly at all. If you do a KVO compliant update under those circumstances, the array controller will get a KVO notification and update its internal state automatically. You shouldn’t need to re-filter manually.
In theory, that allows the array controller to optimize what it does with the update. If you just add one object, it shouldn’t need to rescan everything in the array, or apply the filter predicate to anything except the object you added. (Caveat: it’s a black box, so we don’t know what it does, but we HOPE that it does this efficiently.)
_______________________________________________
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