Are there any Objective-C / Cocoa naming conventions for properties that are acronyms?
- by t6d
I have an object that models an online resource. Therefore, my object has to store the URL of the resource it belongs to. How would I name the getter and setter?
MyObject *myObject = [[MyObject alloc] init];
// Set values
[myObject setURL:url];
myObject.URL = url;
// Get values
[myObject URL];
myObject.URL;
or would the following be better:
MyObject *myObject = [[MyObject alloc] init];
// Set values
[myObject setUrl:url];
myObject.url = url;
// Get values
[myObject url];
myObject.url;
The former example would of course require to define the property in the following way:
@property (retain, getter = URL, setter = setURL:) NSURL *url;