Book Image

Mastering Swift

By : Jon Hoffman
Book Image

Mastering Swift

By: Jon Hoffman

Overview of this book

Table of Contents (22 chapters)
Mastering Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 like the one in the following screenshot:

From this menu, we will want to select the Create a new Xcode project option. This option will walk us though creating a new Xcode project. Once this option is selected, Xcode will start up and we will see the following menu. As a shortcut, if we do not see this...