I notice that you can ‘double declare’ a variable in this way:
@interface A {
NSString *instanceVariable;
}
@property (nonatomic, retain) NSString *instanceVariable;
@end
This has the same effect that just do:
@interface A {
}
@property (nonatomic, retain) NSString *instanceVariable;
@end
Why doesn’t the compiler complain in situations like this?
Because both ways are valid.
Declaring ivar via just declaring a property for it is a new language feature available starting objc 2.0
In “Run-time differences” section of “Objective-c programming language” reference stated: