I'm new to Objective C.
While I am reading the tutorial here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-BCIGIJJF
It says:
Use keywords before all arguments. Right way:
- (void)sendAction:(SEL)aSelector toObject:(id)anObject forAllCells:(BOOL)flag;
Wrong way:
- (void)sendAction:(SEL)aSelector :(id)anObject :(BOOL)flag;
It confuses me about Objective-C's method names. Here is my question:
1.
The wrong way is not recommended. But it's perfectly legal, right?
2.
The name(signature?) of the method is sendAction:toObject:forAllCells: for the first one and sendAction::: for the second one. Right? I noticed that people emphasize that the colon : is always counted as in the method name. I assume that : indicates an argument will follow and it cannot be modified anyway. So what's the implication of including colon in the method name as it's not subject to my modification.
3.
To make an example, - (void)sendAction :(SEL)aSelector;
So the name of the method should be sendAction :
Noticing the blank space before colon is part of the name, should I consider this as a different method from - (void)sendAction:(SEL)aSelector; ?
The answer should be NO as [anObject sendAction : anSel]; should be the same as [anObject sendAction:anSel];
How do you guys understand the scheme as a whole that make sense? Thanks.
P.S. Appreciate your reading through this question. I am pretty sure I am gonna feel silly once some of you pointed out and cleared my confusion.