0
@property (nonatomic, strong) NSString *dude;
@property (nonatomic) NSString *dude;
@property (nonatomic, weak) NSString *dude;

What exactly is the difference between these 3?

Esqarrouth
  • 36,821
  • 20
  • 155
  • 161

1 Answers1

2

There's no difference between the first and second, as "strong" is the default & implicit attribute.

The third uses a weak reference, which means that when the object is released by the last owner, the dude property becomes nil.

Oh, lastly, NSString properties should actually be declared with "NSString *".

Community
  • 1
  • 1
Michael Dautermann
  • 87,822
  • 17
  • 159
  • 205