I need to populate a UITableView from an NSSet data source. Obviously, I want the table sorted by some criteria.
I could just create a sorted NSArray with [mySet sortedArrayUsing...] and use it for my table data source. But I need something more powerful: the underlying NSSet ( mySet ) changes over time, and I want the UITableView update accordingly (still sorted, of course).
My best bet so far is attaching observers to an NSSet and updating NSArray and UITableView with every change to NSSet . However, it contains quite a lot of code and is not very efficient.
So I would like to have something like this, I think:
NSArray* sortedWrapperArray = [SortedWrapper wrapperFor:mySet sortUsing:sortCriteria];
where sortedWrapperArray automatically updated when the underlying set changes.
Is there something similar or similar in the Objective-C / Cocoa world?
source share