what's the correct key path to observe for a BOOL property?
what's the correct key path to observe for a BOOL property?
- Subject: what's the correct key path to observe for a BOOL property?
- From: Roland King <email@hidden>
- Date: Thu, 16 Dec 2010 21:45:23 +0800
If I have a property foo and it's boolean and has the getter/setter isFoo/setFoo:, what's the correct key path to observe for KVO, assuming default automatic KVO generation as provided by NSObject, is it 'foo', or is it 'isFoo'?
It seemed to me that the method which triggers automatic KVO (setFoo:) only knows about its own signature and so would send a KVO notification for key path 'foo'. However NSOperation (for one) is documented to 'be KVO compliant for the property isFinished' and indeed you have to observe 'isFinished' if you want notifications.
If indeed the default KVO code generates notifications for 'foo' should you, if you have a boolean property using the 'isXXX' syntax, avoid default KVO and trigger your own property changes for isXXX? _______________________________________________
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