Has anyone put together an order-preserving NSDictionary
Has anyone put together an order-preserving NSDictionary
- Subject: Has anyone put together an order-preserving NSDictionary
- From: Scott Ellsworth <email@hidden>
- Date: Thu, 14 Apr 2005 12:36:50 -0700
Hi, all.
I have an NSDictionary as one of my primary datastores. I want to
throw its contents into an NSTableView via the NSArrayController
running the table.
Currently, I do this the ugly way: take the dictionary, grab the key
array, copy it, then use that read-only stable copy to rummage
through. (Done because the ordering can potentially change on you.)
I would much rather have something with both NSDictionary and NSArray
accessors that exposes the underlying key array in a stable order, so
add and delete work correctly and are reflected in the underlying
data. This would involve a subclass that composes an
NSMutableDictionary and NSMutableArray, and which then overrides
appropriate methods and passes them through to the underlying data
stores.
Not terribly difficult conceptually, but enough of a pain to do right
that I do not relish it. Anyone already done this and put it Out There?
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden