I am trying to define some public readonly property which is readable and writable in the scope of object’s method as following:
@interface MyObject : NSObject
@property (readonly, nonatomic, strong) id foo; // <-- WHAT'S THE CORRECT WAY
@end
//
@interface MyObject ()
@property (readwrite, nonatomic, strong) id foo;
@end
//
@implementation MyObject
@syntesize foo = _foo;
@end
But when I type @property (readonly, nonatomic, strong) in Xcode it is never helping me to do it this way. Does it mean that I’m doing something wrong? Is the property flags order important? What approach is recommended to hide the implementation of property’s writing capabilities?
This is a commonly used and absolutely correct pattern. If you don’t like the Xcode completion behaviour about it, you can surely file up a radar.