Re: [Lion] IBOutlets, strong or weak?
Re: [Lion] IBOutlets, strong or weak?
- Subject: Re: [Lion] IBOutlets, strong or weak?
- From: Josh Abernathy <email@hidden>
- Date: Mon, 08 Aug 2011 17:40:14 -0400
According to the AppKit release notes:
"Note that Xcode 4.2 defaults to ARC when creating new projects, and in the WWDC seed release, as well as in the latest version available at the time 10.7 ships, generates outlet declarations that are strong. This is true for outlets generated in new projects as well as when adding new outlet declarations from Interface Builder. In most cases these should be changed to weak (zeroing or not) to avoid cycles that may cause leaks."
On Aug 8, 2011, at 5:21 PM, Sean McBride wrote:
> On Fri, 5 Aug 2011 15:11:25 -0400, Marc Respass said:
>
>> With Xcode 4, I can drag from a control to the header and Xcode will
>> create an outlet and a property. I noticed that Xcode creates a property
>> like this
>>
>> @property (strong) IBOutlet NSTextField *someField;
>>
>> But I have other code where it is defined weak -- I started this project
>> on an earlier build of Xcode . The strong and weak are new ARC types
>> replacing retain and assign (if I remember correctly) and I thought that
>> NSWindowController and NSViewController retain their top level objects
>> so in 10.6 if I wanted to do this, I would make the property "assign".
>> Should I be using "strong" as Xcode seems to think now or "weak" as
>> Xcode used to think?
>
> I haven't tried ARC, but according to WWDC11 video session 101 at 47:00, delegates and outlets should be weak.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
>
>
> _______________________________________________
>
> 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
_______________________________________________
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