I've been asked to use a Objective-C framework in my Swift project.
But I have no idea how to accomplish this.
I've added this file:
Objective-CBridgingHeader.h
Inside this file I've put:
#ifndef Objective_CBridgingHeader_h
#define Objective_CBridgingHeader_h
#import <FMShop/FMShop.h>
#endif /* Objective_CBridgingHeader_h */
Now I was expecting to be able to:
Import FMShop
And get access to that framework using Swift code. However when I try to
Import FMShop
My project no longer compiles claiming that there: "No such module 'FMShop'"
What am I missing here?
My base SDK is iOS 8.0 and I'm using Xcode 7.3.1
This is what my project looks like:

Add a new Objective-C file to your Xcode project. Name it as you please and you should get an alert box asking if you would like to create a bridging header. Then delete that file as it was just used to create Bridging Header.

Alternatively you can you can create a bridging header yourself by choosing File > New > File > (iOS, watchOS, tvOS, or macOS) > Source > Header File. Name the file as "ProjectName-Bridging-Header.h" e.g. if Project Name is Test then give file name as "Test-Bridging-Header.h".
https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
Go to build settings and search for Objective-C Bridging Header key and provide path of your bridging header file.In my case it is "Main/Main-Bridging-Header.h".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With