Chapter 20

Ten Swift Features That Aren’t in Objective-C

Objective-C dates back to the 1980s — quite a long time ago by computer technology standards. In the decades since its first release, Objective-C’s influence on programming language technologies and best practices (along with hardware and operating system changes) has demonstrated that the Objective-C design is robust and flexible. With the dawn of a new century, Apple’s engineers embarked on the development of a new language for the technology world in which we live today.

As of this writing, Objective-C and Swift are both available to developers. Both let you work with the Cocoa and Cocoa Touch frameworks. In all likelihood, Objective-C one day will be replaced by Swift, but this won’t happen quickly. Even with Swift’s shorter learning curve, the transition from Objective-C to Swift will be measured in years.

For now, developers can work in either language. Most of the frameworks are still written in Objective-C, so even if you write your code in Swift, you will need to interact with Objective-C frameworks. Fortunately, this isn’t difficult.

This chapter covers ten Swift features that aren’t available in Objective-C. As you switch back and forth between the two languages, this chapter may help you distinguish between the features available in each language. In general, of course, you can rely on Swift to follow one overall theme: With Swift, you’ll frequently write less code. This is because the Swift language is designed ...

Get Swift For Dummies 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.