Old-style array methods

Before a literal syntax was introduced for creating instances of NSArray, developers used the class method arrayWithObjects:.

 ​ ​ ​ ​/​/​ ​C​r​e​a​t​e​ ​a​n​ ​a​r​r​a​y​ ​c​o​n​t​a​i​n​i​n​g​ ​t​h​r​e​e​ ​p​o​i​n​t​e​r​s​ ​(​n​i​l​ ​t​e​r​m​i​n​a​t​e​s​ ​t​h​e​ ​l​i​s​t​)​
 ​ ​ ​ ​N​S​A​r​r​a​y​ ​*​d​a​t​e​L​i​s​t​ ​=​ ​[​N​S​A​r​r​a​y​ ​a​r​r​a​y​W​i​t​h​O​b​j​e​c​t​s​:​n​o​w​,​ ​t​o​m​o​r​r​o​w​,​ ​y​e​s​t​e​r​d​a​y​,​ ​n​i​l​]​;​

The nil at the end tells the method to stop. Thus, this date array has three objects. (If you forget the nil, it will probably crash your program, but you will at least get a compiler warning.)

The syntax that you used to access items in the dateList array is known as ...

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.