November 2013
Beginner
325 pages
9h 47m
English
You are not allowed to add nil to any of the collection classes we have covered. What if you need to put that idea of nothingness, a “hole,” into a collection? There is a class called NSNull. There is exactly one instance of NSNull, and it is an object that represents nothingness. Here is an example:
NSMutableArray *hotel = [[NSMutableArray alloc] init]; // Lobby on the ground floor [hotel addObject:lobby]; // Pool on the second [hotel addObject:pool]; // The third floor has not been built out [hotel addObject:[NSNull null]]; // Bedrooms on fourth floor [hotel addObject:bedrooms];
Read now
Unlock full access