I am creating a Framework (compiled Library), which has both Swift and Objective C code so I create a bridging header inside my Framework project. The Framework builds fine and the Bridging header has no issues.
However when I drag the product .sdk into my demo project to test importing the Framework, I get the error
Failed to import bridging header "...LibraryName-Bridging-Header.h"
I added multiple paths to the Search Paths without any luck.
Frameworks with mixed Swift and Objective-C code do not need (and should not have) a bridging header.
First make sure that your framework's build settings includes "Defines Module: Yes".
Then, your framework should already have an umbrella header, this is the header with the same name as your framework with stuff like this in it
//! Project version number for MyFramework.
FOUNDATION_EXPORT double MyFrameworkVersionNumber;
//! Project version string for MyFramework.
FOUNDATION_EXPORT const unsigned char MyFrameworkVersionString[];
Any Objective-C stuff that you want to be visible to Swift needs a header with public membership which is imported into that umbrella header like this #import <MyFramework/MyHeaderName.h>
. Note that you need to apply this rule recursively: if you import an Objective-C header in the umbrella header, anything it imports also needs to be public and in the umbrella header.
This can be a little tricky if some of your Objective-C headers have unnecessary imports, or import stuff that you don't want to be public in your framework. You may need to restructure you code a bit so that you have a clear separation between public and private headers.
If you do that, all of that public Objective-C code should be automatically usable in the framework's Swift code, without any bridging header.
Official docs here: https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift