What is the standard Objective-C woll terminal convention?

I know this @property (nonatomic, getter=isWhatever) BOOL whatever;

is the standard way to declare properties BOOL

in Objective-C nowadays (see this question ).

But what is the preferred way to access this property? As far as I understand, for setter and non-setter properties BOOL

, dot notation is preferable to [someObject someProperty]

, but can't a redundant custom getter name do that?

I repeat, I am especially interested in what the agreement with the getter is: in my understanding self.whatever

, which would display [self isWhatever]

unused and getter=isWhatever

meaningless, which seems to be contradictory.

Is this an unintended side effect of the evolution of the language over time?


source to share

2 answers

Choosing a better logical name than "all" will give a better idea. EXAMPLE: character

vs isCharacter

. self.isCharacter

seems fine and arguably better than self.character


It would seem that using "dot notation" does not change the logical conditional "is" convention.



IMHO dot syntax should always be used for properties and parenthesis syntax for methods (you should NEVER refer to a property method (getter / setter method)) and "is" should prefix all BOOL properties (not just the getter). The correct syntax for your property would then be myObj.isWhatever.



All Articles