Chapter 2. The Basics of Swift

The Swift programming language was first introduced in June 2014 at Apple’s Worldwide Developers Conference (WWDC). Swift was a surprise to everyone: Apple had managed to develop an entire language (as well as all of the supporting libraries, developer tools, and documentation) and make it work seamlessly with the existing Objective-C language. And on top of that, it was a really good “1.0” language.

In June 2015, Apple announced Swift 2.0, improving the performance of the language, adding a collection of new features, and making the Cocoa and Cocoa Touch platform APIs more Swift-like in style. Swift was open sourced on December 3, 2015. We can expect Swift to evolve over time, in line with the developments in the Swift Open Source project.


Xcode supports having multiple versions of the Swift language installed. You might have a different version of the language if, for example, you’ve downloaded a copy of Swift from the open source project. For information on how to get a copy and use it in Xcode, go to the Swift project’s Download page.

This book covers version 2.2 of Swift.


If you have older Swift code that you need to update to the latest stable Swift syntax, Xcode provides a converter. Open the Edit menu and choose Convert→To Latest Swift Syntax… to get started.

Swift draws upon an extensive history of language design and has a number of very cool design features that make developing software easier, simpler, and safer. We’ll begin ...

Get Learning Swift 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.