How to define a method that takes multiple parameters

I keep forgetting how to do this… don’t ask me why, it’s not that difficult! So here’s how we define one:

- (void)methodName:(NSString *)parameterOne methodNameContinues:(NSString *)parameterTwo;

Add more parameters as you please. In theory, the method name is split across these multiple descriptive parts before each parameter is defined. However in reality I find it easier to just repeat the parameter names in each section, like this:

- (void)methodName:(NSString *)theString nextString:(NSString *)theNextString;


- (void)callingNames:(NSString *)firstName lastName:(NSString *)lastName;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.