• 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
Re: Using multiple bindings to enable a button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using multiple bindings to enable a button


  • Subject: Re: Using multiple bindings to enable a button
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 11 Feb 2015 01:34:35 -0600

On Feb 11, 2015, at 12:31 AM, Quincey Morris <email@hidden> wrote:

> On Feb 10, 2015, at 21:45 , Steve Mills <email@hidden> wrote:
>>
>> I'm not sure about the KVO compliancy. I'm still a newbie in this area. Let me give you the rundown on the stuff that deals with it.
>>
>> @interface WindController : NSWindowController
>> @property (weak) NSString* comboStringValue;
>> @end
>>
>> The window has:
>>
>> A Combobox binds its Value to File's Owner.self.comboStringValue, because I've learned you can't bind directly to a field's stringValue.

> However, a weak property is never KVO compliant, because its value can potentially change (to nil) at any time, without going through the property setter, which is what supplies the KVO compliance.

> Try changing the “comboStringValue” property to strong. Anyway, it makes no sense for it to be weak.

I recommend making the property "copy" rather than "strong".  First, it's a value property not a relationship property and those should almost always be "copy".  Second, it's also conceivable that the binding passes a reference to an internal mutable string to the property.  That, too, can change in a non-KVO-compliant 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


  • Follow-Ups:
    • Solved: Re: Using multiple bindings to enable a button
      • From: Steve Mills <email@hidden>
References: 
 >Using multiple bindings to enable a button (From: Steve Mills <email@hidden>)
 >Re: Using multiple bindings to enable a button (From: Quincey Morris <email@hidden>)
 >Re: Using multiple bindings to enable a button (From: Steve Mills <email@hidden>)
 >Re: Using multiple bindings to enable a button (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Using multiple bindings to enable a button
  • Next by Date: Re: Disable Text Replacement
  • Previous by thread: Re: Using multiple bindings to enable a button
  • Next by thread: Solved: Re: Using multiple bindings to enable a button
  • Index(es):
    • Date
    • Thread