A. Objective-C Literals

Think about how often you type cookie-cutter templates like [NSNumber numberWith-Integer:5] to produce number objects in your code. Perhaps you’ve defined macros to simplify your coding. Beginning in Xcode 4.4 (and LLVM 4.0), Objective-C literals introduce features that transform awkward constructs such as NSNumber and NSArray creation instances into easy-to-read parsimonious expressions.

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

Now, instead of establishing an endless series of those declarations, you can use a ...

Get The Core iOS Developer’s Cookbook, Fifth 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.