• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDictionary allValues not mutable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSDictionary allValues not mutable
      • From: Ken Thomases <email@hidden>
References: 
 >Re: NSDictionary allValues not mutable (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: [Q] Using NSInvocation vs. selector with NSTimer
  • Next by Date: Re: NSSavePanel does replace / in the filename with a :
  • Previous by thread: Re: NSDictionary allValues not mutable
  • Next by thread: Re: NSDictionary allValues not mutable
  • Index(es):
    • Date
    • Thread