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 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.