Question about the receiver mentioned in Xcode documentation

Shane,

The Xcode documentation often makes a reference to something called a receiver. Most of the time I am pretty sure what that is. But sometimes I’m not so sure.

So I came up with a list the 10 different ASObj-C code lines that I’ve worked with and separated then into 2 list where one is "The receiver is “ClassName” and the other "The receiver is ‘object’ "

Can you tell me if this is correct?


-- ***** The receiver is "ClassName" *****
ClassName's methodNameParameter1:Parameter1
ClassName's methodNameParameter1:Parameter1 withParameter2:Parameter2
ClassName's methodNameParameter1:Parameter1 withParameter2:Parameter2 withParameter3:Parameter3
ClassName's methodNameParameter1:Parameter1 withParameter2:Parameter2 withParameter3:Parameter3 withParameter4:Parameter4

ClassName's alloc()'s init()

-- ***** The receiver is "object" *****
Object's methodName
Object's methodName:Parameter
Object's methodName's methodName()
Object's property1()
Object's property1()'s property2()


-- I know Object's property1()'s property2() looks strange but I actually ran into it with:
set AppleScriptRecords3 to {{|name|:"One", |color|:"Red"}, {|name|:"Two", |color|:"Blue"}}
TheArray1's firstObject()'s firstObject() --> (NSDictionary) {name:"One", color:"Red"}
TheArray1's firstObject()'s lastObject() --> (NSDictionary) {name:"Two", color:"Blue"}

Bill

The receiver is the thing the method is called on – or the thing that receives the message. So the class is the receiver of class methods, and objects are the receiver of object methods.

Thanks Shane :slight_smile: