• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
what's the correct key path to observe for a BOOL property?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: what's the correct key path to observe for a BOOL property?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: App Will Not Terminate After Uncaught Excpetion
  • Next by Date: NSView setAlphaValue question
  • Previous by thread: Re: App Will Not Terminate After Uncaught Excpetion
  • Next by thread: Re: what's the correct key path to observe for a BOOL property?
  • Index(es):
    • Date
    • Thread