Appendix. Objective-C Literals

Think about how often you type cookie-cutter templates like [NSNumber numberWithInteger:5] to produce number objects in your code. Perhaps you’ve defined macros to simplify your coding. Objective-C literals introduce features that transform awkward constructs like NSNumber and NSArray creation instances into easy-to-read parsimonious expressions.

Speaking as someone who has long created/used macro definitions for the NSNumber declarations, I love the way these literals provide more readable, succinct code. They save an enormous amount of typing and provide a natural, coherent presentation.

Now, instead of establishing endless series of those declarations, you can use a simple literal like @5. This number literal ...

Get The Core iOS 6 Developer’s Cookbook, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.