objective-c ARC readonly properties and private setter implementation

前端 未结 2 2085
心在旅途
心在旅途 2021-02-01 04:39

Prior to ARC, if I wanted a property to be readonly to using it but have it writeable within the class, I could do:

// Public declaration
@interface SomeClass :          


        
2条回答
  •  忘了有多久
    2021-02-01 04:50

    You can redeclare your property as readwrite in interface extension:

    @interface SomeClass()
    @property (nonatomic, strong, readwrite) NSString *myProperty;
    @end
    

提交回复
热议问题