Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reason for declaring a property as (strong, strong)

Tags:

objective-c

I just got a large chunk of code that someone else have written. First I dismissed it as a typo but then noticed it in several other places as well.

The essentials is that the other programmer (not sure of his "skill level") declared some properties as

@property (strong, strong) NSObject *anObject;

The compiler does not complain so I was wondering if there is any reason for doing this or should I consider them all to be "typos"?

(The project uses ARC)

like image 647
Groot Avatar asked May 13 '13 08:05

Groot


2 Answers

I see no sense in doing so and am surprised that the compiler does not complain about that.

like image 171
Amin Negm-Awad Avatar answered Oct 30 '22 20:10

Amin Negm-Awad


I think the developer miswrote it. Strong keyword increases the retain count by 1 so by 2 strongs maybe the dev thought to increase retain count by 2..

like image 42
Ahmed Z. Avatar answered Oct 30 '22 20:10

Ahmed Z.