O'Reilly logo

The Core iOS 6 Developer’s Cookbook, Fourth Edition by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required