On Feb 11, 2015, at 12:31 AM, Quincey Morris 
<quinceymor...@rivergatesoftware.com> wrote:

> On Feb 10, 2015, at 21:45 , Steve Mills <sjmi...@mac.com> 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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to