Groot
Groot

Reputation: 14251

Reason for declaring a property as (strong, strong)

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)

Upvotes: 8

Views: 211

Answers (2)

Amin Negm-Awad
Amin Negm-Awad

Reputation: 16650

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

Upvotes: 7

Ahmed Z.
Ahmed Z.

Reputation: 2337

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..

Upvotes: 1

Related Questions