On May 14, 2012, at 10:40 AM, Kyle Sluder wrote:

> On May 14, 2012, at 1:06 AM, Quincey Morris 
> <[email protected]> wrote:
> 
>> 2. Check the KVO compliance of whichever of these keys you use. For example, 
>> a leaf key like this:
>> 
>>   - (BOOL) isLeaf {
>>       return self.properties.count > 0;
>>   }
>> 
>> *isn't* KVO compliant.
> 
> Hmm? As long as you return a set containing "properties" from 
> +keyPathsAffectingIsLeaf, and your class is KVO compliant for "properties", 
> this should also be KVO compliant.

Well, yes, but that's a big "as long as". ;)  I mean, it's not hard to do that, 
but it's not something that most developers think of spontaneously.

Anyway, Quincey's point was that that isLeaf getter _in isolation_ doesn't make 
for a KVO-compliant property.  It is a common mistake.

Cheers,
Ken


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to