Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
- Subject: Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
- From: Fritz Anderson <email@hidden>
- Date: Wed, 22 Mar 2006 00:13:09 -0600
On 21 Mar 2006, at 10:35 PM, Jerry Krinock wrote:
I decided to rewrite my code using NSArrayController, but still the
result
is the same...it seems to use NSMutableDictionary's -objectForKey,
instead
of my beautiful KVC-compliant "accessor" methods.
...
My objects are not instances of a clean, stand-alone class, but are
instead
NSMutableDictionaries, and my "accessor" methods in a category. Is
this the
problem? (A couple months ago I tried to subclass
NSMutableDictionary, but
we know that don't work.)
Without prejudice to the question of whether adding key-value
accessors to an abstract class will work for purposes of the Key-
Value Coding protocol...
Why don't you have a class that includes an NSMutableDictionary as an
instance variable? It would allow you to change the underlying data
structure of your class without having to change all the code that
uses the class. You can probably use the code you already wrote for
your accessors, with small changes.
If such a class needs to respond to some of the NSMutableDictionary
messages, you can write fronts that forward them to the dictionary
instance variable. If it has to respond to all (or nearly all) of
them, research the method forwardInvocation:.
-- F
--
Fritz Anderson -- http://www.manoverboard.org/
Consulting Programmer -- http://resume.manoverboard.org/
Step into Xcode, Now Available -- http://six.manoverboard.org/
_______________________________________________
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