On Sep 27, 2011, at 10:06 AM, Matt Neuburg wrote:
> On Fri, 23 Sep 2011 22:08:43 -0700, Jerry Krinock <je...@ieee.org> said:
>> Yes.  After studying this some more I see that, in older code, I did not 
>> declare outlets as properties.  Instead, I put the IBOutlet directive on the 
>> ivar,
>> 
>> @interface MyWinCon : NSWindowController 
>> {
>>   IBOutlet FooView *m_fooView ;
>> }
> 
> I would just add (perhaps unnecessarily) that on iOS, where KVC is used, one 
> should not be tempted to use a pure ivar instead of property + synthesized 
> accessor, because when KVC sets an ivar directly it retains it and your whole 
> memory management scheme can be thrown off. (This is just one of many reasons 
> why direct KVC access to ivars is scary.) The property, with its declared 
> memory management policy, and the synthesized accessor that implements that 
> policy, acts as a memory management gateway to ward off KVC's curious and 
> probably unwanted memory management behavior.

If you use ARC, that conflict goes away. KVC does the right thing with ARC weak 
or strong or unsafe-unretained ivars. KVC looks for ARC's ivar metadata and 
performs the same memory management as ARC would have.


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to