I have a web service which returns certain "models" of which are all defined by a class in objective-c. Calls to RESTful methods will return either a singular model XML or a list of model XML elements.
<widget>
<a>foo</a>
</widget>
or
<widgets>
<widget>
<a>foo</a>
</widget>
....
<widget>
<a>foo</a>
</widget>
</widgets>
I'm trying to come up with a way to organize my classes in such a way that parsing the object or list of objects is easy and ultimately adding more model objects is easy. It will obviously involve a delegate for each "model", but how do you organize it in such a way that makes it easy and elegant. A xml delegate for each model object? how to handle the lists? Perhaps some type of list delegate object which will then refer to the correct individual model delegate according to some list? (ie: widgets -> widget delegate)
I am going to have a single class which provides all the methods in the webservice.
- (Widget *)getWidgetById: (int) id;
- (some array) getWidgets:;
I guess its really more of a OO design pattern question then anything else.