I'm having a bit of difficulties in getting used with Objective-C properties.. I am showing a piece of code just to explain my doubt:
A.h
@interface A : NSObject
@property (nonatomic,getter = isChosen) BOOL chosen;
@end
main.m
A *myClass = [[A alloc]init];
myClass.chosen = YES;
NSLog(@"1. myClass.chosen = %hhd", myClass.chosen);
myClass.chosen = NO;
NSLog(@"2. myClass.chosen = %hhd", myClass.chosen);
NSLog(@"3. myClass.chosen = %hhd", [myClass isChosen]);
NSLog(@"4. myClass.chosen = %hhd", myClass.isChosen);
OUTPUT
1. myClass.chosen = 1
2. myClass.chosen = 0
3. myClass.chosen = 0
4. myClass.chosen = 0
Everything is clear for me, apart from the last line of code, where I get the value of the chosen property with myClass.isChosen: I understand the dot syntax myClass.chosen, because the compiler converts it in the message notation syntax [myClass isChosen], but I don't really understand why myClass.isChosen works, or better, I think that again the compiler converts it in the message notation but it seems a little bit weird to me.
I'd like to know if it is considered good practice to call the getter method with the dot notation syntax and if it seems weird only to me.. Obviously this is noticed only when you change the getter name in the property declaration, otherwise NSLog 2 and 4 are the same.