In Cocoa Design Patterns, the author sometimes declares a property in @interface as read-only:
// .h @property (readonly, copy) NSArray *shapesInOrderBackToFront;
and then adds an unnamed category to the implementation file (.m) as follows:
// .m @interface MYShapeEditorDocument () @property (readwrite, copy) NSArray *shapesInOrderBackToFront; @end
Any idea on why? I donβt understand how this approach is better or more necessary than initially declaring the readwrite property.
properties objective-c category
RyJ Dec 09 '09 at 20:07 2009-12-09 20:07
source share