• 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: Array of dictionaries containing NSColor in NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array of dictionaries containing NSColor in NSUserDefaults


  • Subject: Re: Array of dictionaries containing NSColor in NSUserDefaults
  • From: Graham Cox <email@hidden>
  • Date: Fri, 13 Nov 2009 11:39:08 +1100

On 13/11/2009, at 8:18 AM, Martin Hewitson wrote:

> Has anyone tried something like this, or can anyone see what I'm doing wrong?


I'm a bit mystified by your data structure here. Why do you use a separate dictionary for each key/value pair (name/colour pair)? Why not just use one dictionary for the list of colours, and add that as a single item to the user defaults? It would be much simpler and efficient, and probably less prone to difficult to understand code paths as you'd have one less level of indirection (or possibly two less - you wouldn't need the array either).

I expect the problem is because the changes you're making are an extra level of indirection inside the data structure and are not being observed by the user defaults binding. I could be wrong though as bindings is not something I'm very intimate with.

Also, check out whether NSColorList will do what you need here - it already maintains lists of named colours.

--Graham


_______________________________________________

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: Array of dictionaries containing NSColor in NSUserDefaults
      • From: Martin Hewitson <email@hidden>
References: 
 >Array of dictionaries containing NSColor in NSUserDefaults (From: Martin Hewitson <email@hidden>)

  • Prev by Date: Re: How do I get Lucida Grande italic into my application?
  • Next by Date: Re: Array of dictionaries containing NSColor in NSUserDefaults
  • Previous by thread: Array of dictionaries containing NSColor in NSUserDefaults
  • Next by thread: Re: Array of dictionaries containing NSColor in NSUserDefaults
  • Index(es):
    • Date
    • Thread