Re: [Lion] IBOutlets, strong or weak?
Thanks a lot Josh and Sean. I never remember to read the release notes but I just went through AppKit's. I'm going back to the straight iVar style for Mac OS X for now. I was putting them all in the class continuation category anyway since they shouldn't be exposed externally. Marc On Aug 8, 2011, at 5:40 PM, Josh Abernathy wrote: > 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 s...@rogue-research.com >> Rogue Researchwww.rogue-research.com >> Mac Software Developer Montréal, Québec, Canada >> >> >> ___ >> >> 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/joshaber%40gmail.com >> >> This email sent to josha...@gmail.com > ___ 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
Re: [Lion] IBOutlets, strong or weak?
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 s...@rogue-research.com > Rogue Researchwww.rogue-research.com > Mac Software Developer Montréal, Québec, Canada > > > ___ > > 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/joshaber%40gmail.com > > This email sent to josha...@gmail.com ___ 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
Re: [Lion] IBOutlets, strong or weak?
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 s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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
[Lion] IBOutlets, strong or weak?
Hi All, I'm writing a Lion-only application and trying to do things more iOS-like (which appears to be the direction but regardless, I like it) by creating properties for my IBOutlets. I am using the latest Xcode 4.2 and ARC. 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? Any advice on this is appreciated. Thanks Marc ___ 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