[英]Objective C methods naming conventions
What name is better for the "delete" method that deletes document in database with given documentID? 对于使用给定documentID删除数据库中的文档的“删除”方法,什么名称更好?
1) -(void) deleteDocumentWithID:(NSString *) documentID error:(NSError **)error;
1)
-(void) deleteDocumentWithID:(NSString *) documentID error:(NSError **)error;
or 要么
2) -(void) deleteDocumentByID:(NSString *) documentID error:(NSError **)error;
2)
-(void) deleteDocumentByID:(NSString *) documentID error:(NSError **)error;
Your naming conventions are completely up to you, as mentioned in the apple doc try and be as descriptive as possible with your method names so any third party looking at your code (header file) will be able to get an idea quickly on what the method does. 您的命名约定完全取决于您,如Apple doc中所述尝试并尽可能使用您的方法名称描述,因此任何查看您的代码(头文件)的第三方都能够快速了解该方法的内容确实。 From the code you posted you are on the right track.
从您发布的代码中,您走在正确的轨道上。
Have a look at this document. 看看这个文件。
Have a look at Programming with Objective-C 看看Objective-C编程
By and with depends on you 随着和取决于你
-(void) deleteDocumentWithID:(NSString *) documentID error:(NSError **)error;
-(void) deleteDocumentByID:(NSString *) documentID error:(NSError **)error;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.