UITableView IndexArray

If you have tables that involve arbitrarily sortable data, might want to take a look at this:

A Better Table View Data Structure

…so I submit to the community my IndexArray class which takes care of much of the boiler plate for you…

  • Everything should be sortable: keys and items.
  • I want to be able to add and remove items without having to always resort.
  • I want to be able to specify how the sort should occur. I want this to be as convenient as sorting an array.
  • I don’t want have to worry about the logic of whether a key has an array associated with it when I push items into it.
  • Items should be easily accessible by index so it works rather seamlessly with UITableViews.
  • Keys should have the same freedom as they do in NSDictionary.

Yep, that’s a pretty useful set of attributes. Glancing quickly at the code on github it looks both convenient and lightweight, so would probably make a nice default starting point for your table data modelling needs!

Alex | October 28, 2011

Leave a Reply