In my interface (.h) file, I have
@property(readonly) NSString *foo;
and in my implementation (.m) file, I have
@synthesize
It is here as a declaration to the rest of your code.
When you a access the property of this class from an other part of your code, you need to know if the object you get is strong or weak.
It used to be more obvious when ARC didn't exists, because the programmer needed this information. Now, ARC makes a lot of things transparent, so it is true, you might wonder why it is still here.
Why can’t the compiler intelligently deduce a default setting for a read-only property?
I assume it would be pretty easy to set the convention that no keyword means strong
or means weak
. If it hasn't been done, they surely had a reason.