Should IBOutlet be weak or strong var? [duplicate] Should IBOutlet be weak or strong var? [duplicate] swift swift

Should IBOutlet be weak or strong var? [duplicate]


Yes, previously outlets should generally be weak but Apple has changed that. Now they recommend to use strong outlets in the WWDC 2015 session Implementing UI Designs in Interface Builder. The only reason why it might be weak is retain cycle.


It doesn't matter weak or strong the outlet is in most cases. You just be sure that you don't have strong reference cycles.

Subviews shouldn't have strong outlets to their superviews and view shouldn't have strong outlet to its controller, because superview already has strong reference to its subviews and controller has strong reference to its view.