id

When declaring a pointer to hold the address of an object, most of the time you specify the class of the object that the pointer will refer to:

N​S​D​a​t​e​ ​*​e​x​p​i​r​a​t​i​o​n​;​

However, often you need a way to create a pointer without knowing exactly what kind of object the pointer will refer to. For this case, you use the type id to mean a pointer to some kind of Objective-C object Here is what it looks like when you use it:

i​d​ ​d​e​l​e​g​a​t​e​;​

Notice that there is no asterisk in this declaration. id implies the asterisk.

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.