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 swift project, Xcode will create an Objective-C Bridging Header file in the swift project automatically. But sometimes you will find it do 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.
    xcode file new file menu item
  2. Then select the iOS Header File template in the popup dialog window and click Next button.
    xcode ios cocoa touch class template
  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.
    xcode objective c bridging header file
  4. Input below source code to import the Objective-C header file in above Objective-C bridging header file.
    #import "TestObjectiveCClass.h"
  5. Now the Objective-C Bridging Header file has been created manually successful.

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

  1. Click the Xcode swift project in left project navigator pane.
    input objective c bridging header file path in xcode swift project - target - build settings - objective c bridging header
  2. Then click TestProject in the TARGETS list in center editor panel.
  3. Click Build Settings tab at the top of target detail pane.
  4. Then search Objective-C Bridging Header in the search box.
  5. Click the arrow before 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.
    edit the objective c bridging header file path in build settings item
  6. Now you can use the objective-c class in the swift class file directly, you can read article How To Call Objective C Code From Swift Project to learn more.


  1. How To Call Objective C Code From Swift Project
0 0 votes
Article Rating
Notify of

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

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x