Friday, 23 August 2013

Best iOS data structure to store sizes and colours of a product

Best iOS data structure to store sizes and colours of a product

I am developing an iOS application that deals with products. These
products obviously can have sizes and colours (clothes, for example). Now
I need a good data structure to store the available colours and sizes for
the current product (for one product at a time). The price has also to be
a part of the data structure, since every colour-size combination might
have a different price, as well as a URL for the product image of the
specified size.
I have thought of a two-dimensional array (i.e. NSArrays of NSArray) with
first dimension as colour and second as the size and the content of the
cell is the price and the URL, but then there is some inconvenience when
the product has only sizes without colours or vice versa.
Is there some other better data structure that satisfies my needs, or my
choice was the best?
Thanks!

No comments:

Post a Comment