@interface first : <NSObject> {
NSString *myStr;
/**
I don't understand why declared this NSString *myStr.
Even if not declare NSString *myStr, this codes work well.
**/
}
@property (nonatomic, retain) NSString *myStr;
and Add @synthesize to first.m
Is it correct that I don’t need to declare myStr as an instance variable if I always use the myStr property, i.e. self.myStr?
In the modern runtime (with a reasonably recent version of xcode, simulator etc.) it makes no difference because the compiler generates it for you.
Note that with the newest version of LLVM you don’t even need the synthesize 😉