Objective-C Method signature

Notes on Objective-C Method Signatures

I’m still not finding the Cocoa Touch language ‘natural’ so I decided to make a few notes and make sone examples to cement my understating.


- (id)initWithInt:(int)value;

defines a method initWithInt that returns a general object (an id) and takes one integer argument. Objective-C only requires a type in a signature to be explicit when the type is not id; this signature is equivalent:

- initWithInt:(int)value;

(see Wikipedia method signature)


Class Methods are declared by +

Instance Methods are declared by a preceding –

(see p.36 Introduction to The Objective-C 2.0 Programming Language )


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s