IBOutlets - Property or Variable?


#1

Hello,

In Chapter 7, it mentioned that convention for IBOutlets is to declare them as weak references. However, in Apple’s Resource Programming Guide, in the Managing the Lifetimes of Objects from Nib Files, they recommend that they are declared as properties

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW6

Are there any advantages to one over the other? Do both styles work correctly on Mac OS X as well? In most cases the outlets are private implementation details of the enclosing class so if one style makes it easier to get them out of the interface definition and into the implementation file (and still work with XCode IB) that would be an advantage.

Thanks,
Rob Saccone


#2

In the next edition of the iOS book, our style will officially be: all outlets are weak properties in the class extension.