How To Fix Xcode Not Automatically Creating Bridging Header File Issue

If you want to import objective-c class’s .h and .m file into the swift project, Xcode will create an Objective-C Bridging Header file in the swift project automatically. But sometimes you will find it does not create the objective-c bridging header file, so you need to create and configure it manually. This article will tell you how to do it.

1. Create Objective-C Bridging Header File Manually In Xcode Swift Project.

  1. Click File —> New —> File menu item at Xcode top menu bar.
  2. Then select the iOS Header File template in the popup dialog window and click the Next button.
  3. Input the header file name and select the swift project folder to save it. Please note the header file name format should be <Project Name>-Bridging-Header, for example, TestProject-Bridging-Header.h.
  4. Input below source code to import the Objective-C header file in the above Objective-C bridging header file.
    #import "TestObjectiveCClass.h"
  5. Now the Objective-C Bridging Header file has been created manually successfully.

2. How To Configure Objective-C Bridging Header File In Xcode Target Build Settings.

  1. Click the Xcode swift project in the left project navigator pane.
  2. Then click TestProject in the TARGETS list in the center editor panel.
  3. Click the Build Settings tab at the top of the target detail pane.
  4. Then search Objective-C Bridging Header in the search box.
  5. Click the arrow before the Objective-C Bridging Header item to expand it. Then click the plus icon (+)to add the bridging header file name and path in the input text box. Please note the path is relative to the swift project.
  6. Now you can use the objective-c class in the swift class file directly, you can read the article How To Call Objective C Code From Swift Project to learn more.


  1. How To Call Objective C Code From Swift Project

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.