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.
@property (nonatomic) float heightInMeters; @property (nonatomic) int weightInKilos;
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 property attribute. Sometimes a class needs a “read-only” property – a property ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access