Objective-C : (private / public properties) making a property readonly for outside class calls and readwrite for self calls

后端 未结 4 909
野的像风
野的像风 2020-12-04 18:01

Would you know a way to make a property readonly for outside calls and readwrite for inside calls ?

I\'ve read times ago somthing that seemed like

In the .h

4条回答
  •  无人及你
    2020-12-04 18:28

    In your .h:

    @property(nonatomic, retain, readonly) NSDate* theDate;
    

    In your .m:

    @interface TheClassName()
    @property(nonatomic, retain, readwrite) NSDate* theDate;
    @end
    

提交回复
热议问题