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;

or

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




Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.