Lets say that i have a class with some instance variables and i want to expose those i-vars for "Read Only" use through Dot Notation Property, but in the same time to be able to use the Property Mutator inside my class, also with Dot Notation.
The problem is, that is i'm declaring in my .h file like that:
@property (readonly) ....
Then even if i'm writing the mutator myself (-(void) setMyIvar:
) i cant use it with the dot notation because the compiler is complaining (rightfully) that the property is readonly.
I tried to re-declare the property in my .m file (inside an interface extension) like that:
@inteface MyClass()
@property (retain) myIvar;
@end
But the compiler did not accept this double-declaration.
Is there any way i can do that?
You can do this, but you'll have to do it like this:
@property (retain,readonly) ....
In your implementation:
@inteface MyClass()
@property (retain,readwrite) myIvar;
@end
In other words, the declaration should be the same, apart from the accessibility.