O'Reilly logo

Learn Swift on the Mac: For OS X and iOS by Waqar Malik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    19

Mix and Match

Whether you’ve decided to start a new project that uses Swift, or want to update an existing Objective-C project to use Swift, you’ll end up needing both languages in your projects. Apple calls this feature mix and match, where code written in either language can co-exist and work with the other.

Xcode has made the process of working in a mix-and-match environment quite easy. You simply create the files you need and Xcode will prompt you with the appropriate actions to take.

You start with couple of important header files. The first is the bridging header where you define the Objective-C API you need to expose to Swift source files. And the other is the reverse bridging header, which the compiler generates and will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required