On Objective-C/Cocoa Key-Value coding and arrays
I'm trying to work out the "correct" way to handle populating an array with key-value coding for an iPhone app. I've come up with something that works, but it's fairly hackish. Basically I'm parsing an XML document into a set of code-generated models. Let's assume the XML is of this format: <foo> <bar> <item name="baz" /> <item name="bog" /> </bar> </foo> On my generated object that represents the Bar element, I have an NSMutableArray defined for the sub-node: @interface Bar : NSObject { NSMutableArray *item; } @end So by default when I call setValue:forKey: on an instance of Bar, it ends up