O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Mikey Ward, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

@​p​r​o​p​e​r​t​y​ ​(​r​e​a​d​o​n​l​y​)​ ​i​n​t​ ​v​o​l​t​a​g​e​;​

Lifetime specifiers

A property can also be declared unsafe_unretained, assign, strong ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required