I have several NSArray objects that, effectively, represent the contents of what on might consider a database table. I would like to sort one of them and have all of the others get sorted in the same order.
An example of this would be to have NSArray objects for “name”, “address” and “phone_number” and sort them all by name.
The current approach is a custom shell sort routine that only runs comparisons on “name” but moves data around on all affected arrays. This works and it is relatively clean. Of course, you take a hit due to the overhead of NSObjects vs C arrays.
Is there a faster, cleaner, more “iOS” way to do this?
Drop it all into an SQLite table and do it that way?
One clean way is to store the data in a single
NSArrayofNSDictionaryobjects. Then you can sort the array like this:The only other way I can think of is:
namearray.