Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between readonly and readwrite in Objective C?

Can any one tell me the difference between readonly and readwrite properties in the iPhone SDK?

like image 547
user1099178 Avatar asked Nov 29 '22 02:11

user1099178


1 Answers

readwrite Indicates that the property should be treated as read/write. This attribute is the default. Both a getter and setter method are required in the @implementation block. If you use the @synthesize directive in the implementation block, the getter and setter methods are synthesized.

readonly Indicates that the property is read-only. If you specify readonly, only a getter method is required in the @implementation block. If you use the @synthesize directive in the @implementation block, only the getter method is synthesized. Moreover, if you attempt to assign a value using the dot syntax, you get a compiler error.

For more visit this reference

Hope, this will help you..

like image 165
Nitin Avatar answered Dec 09 '22 17:12

Nitin