Sitemap

Objective C

Aug 24, 2026

--

Property Attributes

@property (nonatomic, strong) NSString *name;
@property (nonatomic, weak) id<MyDelegate> delegate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) NSInteger count;
@property (nonatomic, readonly) BOOL isReady;

Get potatoDev’s stories in your inbox

Join Medium for free to get updates from this writer.

Key attributes:

  • strong — owns/retains the object (ARC).
  • weak — non-owning, auto-nils on dealloc (like Swift's weak).
  • copy — copies on assignment (common for NSString, blocks, to prevent mutation).
  • assign — for primitives / non-owned.
  • atomic / nonatomic — accessor thread-safety (covered earlier).
  • readonly / readwrite — mutability of the property.

Each @property declares a property and, in the parentheses, lists attributes that tell the compiler how to synthesize the getter/setter — controlling memory management, thread safety, and mutability

@property (attributes) Type name;
// ^^^^^^^^^^ memory + threading + access rules

Every attribute list here has three kinds of decision:
a threading attribute (nonatomic),
a memory/ownership attribute (strong/weak/copy/assign),
and optionally an access attribute (readonly).

--

--