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

Can someone tell me the difference between the properties readonlyand readwritethe iPhone SDK?

+3
source share
1 answer

read and write  Indicates that the property should be considered read / write. This attribute is the default value. The block @implementationrequires both the getter method and setter. If you use the directive @synthesizein the implementation block, the getter and setter methods are synthesized.

read-only  Indicates that the property is read-only. If you specify read-only, @implementationonly the getter method is required in the block . If you use the directive @synthesizein a block @implementation, only the getter method is synthesized. Moreover, if you try to assign a value using the point syntax, you will get a compiler error.

See this link for more details.

Hope this helps you.

+18
source

All Articles