Re: Array of dictionaries containing NSColor in NSUserDefaults
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