On Dec 19, 2013, at 8:03 AM, Chris Page wrote: On Dec 18, 2013, at 8:35 PM, Shane Stanley < email@hidden> wrote: on containsObject:anObject -- whether array contains an object return ((setStore's containsObject:anObject) as integer = 1) end containsObject:
Looks like you missed renaming one “setStore” to “arrayStore" when adapting the code to lists.
By the way, I don’t recommend naming “setStore” with “set” as a prefix, because that’s the Cocoa naming convention for setter methods/handlers.
A little more on this that might clarify it a bit for ya.
In Objective-C, with you have a declared property in an NSObject, it gets accessor methods when it's "synthesized", or when it's made real so that code can access it.
These accessors are the ones to set and get the values of the property object.
Now, you'd assume that the methods just append the words "set" and "get" on to the variable and then capitalize the next letter of the method, like so:
Property: bunnies Expected accessors: setBunnies getBunnies
What really happens is very close to this.
The set accessor is indeed setBunnies, but the get accessor method is the exact name of the variable, bunnies. This can be confusing to the uninitiated, because at first glance, you're not sure if you're directly accessing a property's value, or if you're calling an accessor method on the object that holds the property and it returns the value.
Property: bunnies Real accessors: setBunnies bunnies
So, here's what both look like:
Accessing the property directly:
Getting NSBunnies *myBunnies = myAwesomeObject.bunnies; // syntax is: object dot property.
Setting myAwesomeObject.bunnies = [[NSBunnies alloc]initWithMoreBunnies: 5];
And through the accessor methods:
Getting NSBunnies *myBunnies = [myAwesomeObject bunnies]; // the brackets mean a method call on an object. [anObject aMethodInIt]
Setting [myAwesomeObject setBunnies: [[NSBunnies alloc]initWithMoreBunnies: 5]];
Hope that helps (a little) And with that done, back to the everlasting joy that is the appearance manager. |