Re: Detecting reading a key in KVC
Re: Detecting reading a key in KVC
- Subject: Re: Detecting reading a key in KVC
- From: Ken Thomases <email@hidden>
- Date: Thu, 11 Nov 2010 10:30:47 -0600
On Nov 11, 2010, at 7:11 AM, Graham Cox wrote:
> Just write a wrapper for -setObject:forKey: and -valueForKey: The first just calls the same method on its (mutable) dictionary, the second can first check for whether the value is actually present and if not kick off some task to fetch it, or else just get it from the dictionary and return it.
You should not override -setValue:forKey: or -valueForKey: if you can avoid it. Instead, implement the methods -setValue:forUndefinedKey: and -valueForUndefinedKey:. They are precisely for implementing "dynamic" properties in this manner.
Regards,
Ken
_______________________________________________
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