Re: NSDictionary allValues not mutable
Re: NSDictionary allValues not mutable
- Subject: Re: NSDictionary allValues not mutable
- From: Trygve Inda <email@hidden>
- Date: Mon, 18 Oct 2010 15:22:53 +0000
- Thread-topic: NSDictionary allValues not mutable
> So if the master dictionary and the array for the NSTable are
> encapsulated together in a class, you could use NSMutableArray as the
> primary structure, and encapsulate a hidden NSMutableDictionary used
> only for faster searching. Both are maintained in parallel by the
> enclosing class, so there's never any need to ask the dictionary for
> its array of values, nor to copy an immutable array to make a mutable
> version for table insertion. In short, make a class that
> encapsulates all the desired behavior by itself, rather than using a
> naked dictionary and the supplementary arrays it makes.
How would I go about doing this and still bind to my NSArrayController?
I'd have a (singleton) class MyDataClass with two instance vars: myArray and
myDictionary both of which would hold the same objects and both would be
mutable.
So when I bind the NSArrayController to myArray, and the user adds an item
via the table (and thusly the add: of NSArrayController), how will my class
know that it needs to also add it to the myDictionary?
Thanks,
T.
_______________________________________________
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