IBOutlets - Property or Variable?



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


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.

Rob Saccone


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