Reputation: 92
How can I go about achieving this
Property has to be readwrite for inner implementation in class
Property has to be readonly for external interaction to instances of the class
Upvotes: 0
Views: 78
Reputation: 21
Try like the following example
In your .h:
@property(nonatomic, retain, readonly) NSDate* theDate;
In your .m:
@interface TheClassName()
@property(nonatomic, retain, readwrite) NSDate* theDate;
@end
Upvotes: 1
Reputation: 385600
@interface MyObject : NSObject
@property (nonatomic, readonly, strong) NSString *myProperty;
@end
// Class extension
@interface MyObject ()
// Redeclare property read-write
@property (nonatomic, readwrite, strong) NSString *myProperty;
@end
@implementation MyObject
...
class MyObject {
private(set) var myProperty: String
...
Upvotes: 1