34 More about Properties
By now, you have used properties in many programs. In this chapter, you will learn a few more things about properties and what you can make them do.
More on property attributes
First let’s take a closer look at the different attributes you can use to control how the accessors will be created.
Mutability
A property can be declared readwrite or readonly. The default is readwrite, which means that both a setter and a getter method are created. If you do not want a setter method to be created, you mark the property as readonly:
@property (readonly) int voltage;
Lifetime specifiers
A property can also be declared unsafe_unretained, assign, strong, weak, or copy. This option determines ...
Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.