O'Reilly logo

Mastering Swift 4 - Fourth Edition by Jon Hoffman

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

The Objective-C bridging header file - part 1

In order to expose our Objective-C files to our Swift code, we rely on an Objective-C header file. The first time we add an Objective-C file to a Swift project or a Swift file to an Objective-C project, Xcode will offer to create this file for us. It is easier to let Xcode create and configure this file rather than doing it manually, so it is recommended to select Create Bridging Header when Xcode offers to create it.

If, for some reason, we need to create the Objective-C bridging header file manually, we would take the following steps:

  1. Create an Objective-C header file in our project using the New File... option we saw earlier. The recommended naming convention for this file is [MyProjectName]-Bridging-Header.h ...

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