"[Objective-C] Basic Concepts"

Property

Use weak property to avoid strong reference cycle

+---------------------------------------------------------------------+
| NSTableView:                       Delegate Object:                 |
|                          strong                                     |
|                        --------->                                   |
| @property id delegate;            @property NSTableView *tableview; |
|                        <---------                                   |
|                          strong                                     |
+---------------------------------------------------------------------+
+----------------------------------------------------------------------------+
| NSTableView:                              Delegate Object:                 |
|                                  weak                                      |
|                               --------->                                   |
| @property (weak) id delegate;            @property NSTableView *tableview; |
|                               <---------                                   |
|                                 strong                                     |
+----------------------------------------------------------------------------+

Use object cache to keep weak object alive

Use copy property

Category

Protocol

Delegate