开发者

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

开发者 https://www.devze.com 2022-12-15 02:18 出处:网络
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 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 sec开发者_运维问答ond one is very clear but the first one seems to be very confusing to me.

What do you think?


Apple use names such as

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

So, perhaps:

- (BOOL) loginAndReturnError:(NSError **) error;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号