On 13/11/2009, at 4:41 PM, Martin Hewitson wrote:

> The point is to store an array of 'items' with a 'name' together with a 
> 'color'. And later there may be more properties of an 'item'. 


This really calls for your own 'item' class that holds all the various 
properties that you have in mind. You can then easily bind to any property, and 
the class becomes a strict "template" for the valid properties of the item. A 
dictionary is open-ended and can't be made to conform to a common template. You 
will therefore be doing a lot of extra work to force it to fit your design when 
a simple class is sufficient. Make it NSCoding compliant for easy archiving to 
NSUserDefaults.

KVC makes the ordinary properties of an object "look like" a kind of 
dictionary, but forcing an actual NSDictionary to stand in for an object is 
often quite painful and more hassle than it's worth just to save implementing a 
simple class, or to gain some minor functionality for free, such as archiving. 
As it stands an 'item' class with two properties shouldn't take very long to 
code - you'll be glad you did.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to