Singh
Singh

Reputation: 2161

Naming convention for method names in Objective C

I have a class name 'Login' which is subclass of UIViewController. I was starting to write methods for User Login and Signup . So how should i be naming the methods as -(IBAction)loginUser:(id)sender; and -(IBAction)signUpUser:(id)sender; or just -(IBAction)login:(id)sender; and -(IBAction)signUp:(id)sender; . If we go by apple coding conventions which one is recommended.

Upvotes: 0

Views: 591

Answers (2)

dev gr
dev gr

Reputation: 2441

-(IBAction)loginUser:(id)sender;
-(IBAction)signUpUser:(id)sender;

Above two should be used because they are clearly explaining what is the action and make more sense.

Here is the link explaining Cocoa Coding Conventions.

Upvotes: 1

Witterquick
Witterquick

Reputation: 6140

For objective-c the methods should be detailed as possible (even if it makes their name very long). For your case you probably should use

-(IBAction)signUpUser:(id)sender;
-(IBAction)loginUser:(id)sender

Edit: you can read this for a lot of objective-c conventions: https://github.com/raywenderlich/objective-c-style-guide#naming

Upvotes: 0

Related Questions