Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C methods which their only parameter is an NSError object reference, How should I name them?

Tags:

objective-c

I was designing a class and I realize that I've got several methods that the only parameter they have is the output parameter for errors. The problem is how should I name this methods, because they can get very confusing. I've been reading the Apple's Code Guidelines and it saids nothing about this. Here is an example:

-(BOOL)loginError(NSError **) anError;

-(BOOL)loginWithUsername:(NSString *)aUsername password:(NSString *)aPassword error:(NSError **) anError;

The second one is very clear but the first one seems to be very confusing to me.

What do you think?

like image 342
GuidoMB Avatar asked Dec 28 '09 04:12

GuidoMB


1 Answers

Apple use names such as

- (BOOL) saveValuesAndReturnError:(NSError **) error;

So, perhaps:

- (BOOL) loginAndReturnError:(NSError **) error;
like image 126
dreamlax Avatar answered Nov 15 '22 05:11

dreamlax