Re: Detecting reading a key in KVC
Re: Detecting reading a key in KVC
- Subject: Re: Detecting reading a key in KVC
- From: Quincey Morris <email@hidden>
- Date: Fri, 12 Nov 2010 12:20:53 -0800
On Nov 12, 2010, at 12:05, Remco Poelstra wrote:
> If I understand it correctly, for all properties, each and everytime, valueForUndefinedKey is called?
Correct.
> So I do also need to override setValue:forUndefinedKey in case 2? To make sure that the properties end up in the dictionary?
Correct. I omitted the setter behavior for brevity in the discussion.
> Basically it's the same to what I've now (based on the discussion with Graham), but adding "Undefined" to my method names, I do keep the performance enhancements of the original implementation?
It has *better* performance than the original implementation. Originally, *every* call to 'valueForKey:' involved custom code and an extra dictionary lookup. With this implementation, that only happens for your keys -- and genuinely undefined keys, of course.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden