Property attributes

A property declaration can have one or more property attributes. Property attributes give the compiler more information about how the property should behave. Property attributes appear in a comma-delimited list in parentheses after the @property annotation.

In BNRPerson, the properties are declared as nonatomic.

@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​)​ ​f​l​o​a​t​ ​h​e​i​g​h​t​I​n​M​e​t​e​r​s​;​
@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​)​ ​i​n​t​ ​w​e​i​g​h​t​I​n​K​i​l​o​s​;​

Properties are either atomic or nonatomic. The difference has to do with multithreading, which is a topic beyond the scope of this book. All of the properties that you will declare in this book will be nonatomic.

Let’s consider another ...

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.