Using Swift and Objective-C together in the same project

In this section, we will be walking through how to add Swift to an Objective-C project. The same steps can also be used to add the Objective-C code to a Swift project. In the downloadable code for this book, you will find both Objective-C and Swift projects. These projects demonstrate how to add the Swift code to an Objective-C project and how to add Objective-C code to a Swift project. In those projects, we can see that mix and match functions exactly the same, no matter what type of project we are using.

Creating the project

Let's begin by creating an iOS project to work with. When we first start Xcode, we should see a screen that looks similar to the following screenshot:

From this menu, ...

Get Mastering Swift 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.