Incorrect relationship for doneBarButton

In Ch. 12 within the “Polish it up” section, it states to add the new IBOutlet doneBarButton as:
@IBOutlet var doneBarButton: UIBarButtonItem!
Doing such could cause a strong reference cycle I believe which could crash the app for other readers if not handled properly.

It should be a weak relationship:
@IBOutlet weak var doneBarButton: UIBarButtonItem!

Thank you for your feedback :slight_smile:

While conventional wisdom states that you should have outlets be weak, not having the outlets as weak does not necessarily pose a problem. In fact, Apple has flip flopped between having outlets as week or as strong at different times.

In fact, some versions of Xcode, if I recall correctly, generated code that had the outlet be strong. So, while I agree that having outlets be weak is what most people seem to go with, it doesn’t mean that you’ll have crashes just because you defined an outlet as strong (or not weak).

Please refer to the following discussions for more information: