Swift Bridging Header import issue Swift Bridging Header import issue ios ios

Swift Bridging Header import issue


Be careful to add the file to the folder that your error is complaining!I've made the same mistake, if you create the file from Xcode, it will go to the folder: Project->Project->Header.h

And Xcode is looking for Project->Header.h

That means you need to put the file inside your project folder (ProjectName->ProjectNameFolder)!

Hope that helps ;)

UPDATED:I'm not sure if I got what you mean, but try this to solve your problem:
1. Delete all your bridging files that you created until now.
2. Select the main folder of project and hit new file->iOS->Header file.
3. Write your imports in the header file created.
4. Select the project inside Xcode->Build Settings, type in search field: bridging and put in the key SWIFT_OBJC_BRIDGING_HEADER the name of your header file or the path to it!

If you follow this steps, your header file will be created at the correct location!

:D Hope that helps!


In my case this was actually an error as a result of a circular reference. I had a class imported in the bridging header, and that class' header file was importing the swift header (<MODULE_NAME>-Swift.h). I was doing this because in the Obj-C header file I needed to use a class that was declared in Swift, the solution was to simply use the @class declarative.

So basically the error said "Failed to import bridging header", the error above it said <MODULE_NAME>-Swift.h file not found, above that was an error pointing at a specific Obj-C Header file (namely a View Controller).

Inspecting this file I noticed that it had the -Swift.h declared inside the header. Moving this import to the implementation resolved the issue. So I needed to use an object, lets call it MyObject defined in Swift, so I simply changed the header to say

@class MyObject;


Find the path at:

Build Settings/Swift Compiler-Code Generation/Objective-C Bridging Header

and delete that file. Then you should be ok.