Welcome to the Treehouse Community
Looking to learn something new?
self.funFactLable.text= self.factBook.randomFact; vs self.funFactLable.text= [self.factBook randomFact]; @7:06
Im assuming that self.funFactLable.text= [self.factBook randomFact]; is just the objective-c way to do things but I like the dot notation feel of self.funFactLable.text= self.factBook.randomFact;
I found an interesting debate here: http://qualitycoding.org/dot-notation/
It seems to get mixed reviews and clearly the video used: [self.factBook randomFact]; So moving forward should I just abandon my love of dot notation in objective-c land or is this just a case of whats your favorite ice cream flavor?
*I try to guess before he codes things thats how this question came about if anyone even cares lol
Michael Hulet47,842 Points
I share your love of dot notation, but in Objective-C, I only use dot notation whenever the value I'm trying to access is a
@property of its associated class. For example:
@interface FactBook : NSObject //In my opinion, this should be accessed with dot syntax @property (strong, nonatomic) NSString *topFact; //In my opinion, this should never be accessed with dot syntax -(NSString *)randomfact; @end
I believe that's what dot notation was introduced to do, so that is what I use it for