Reputation: 167
1. Please confirm if I understand this correctly.
I have a line of code below,
@property (strong, nonatomic) Month *august;
and it will setup below.
1 setter
-(void)setAugust:(Month *)august
1 getter
-(Month *)august
and 1 ivar _august
and when I implement my own setter, I have to
_august = august
(inside of setter to assign the ivar with proper value)
2.
Another question,
some example shows:
when I implement setter , they use
_ivar = ivar;
and others use
@synthesize _ivar = ivar;
.
I believe @synthesize was used to create setter and getter but it's abbreviated as of iOS 6, right? I am confused of using the statement while implementing setter.
3.
@property (nonatomic, getter=isPlan) BOOL plan;
What does "getter=" exactly mean?
Upvotes: 1
Views: 147
Reputation: 119041
@synthesize
used to be required but isn't any more. This is a feature of Xcode (the compiler really), not any version of iOS.getter
method with a different signature:Normal:
- (BOOL)plan;
Specified:
- (BOOL)isPlan;
Upvotes: 3