Setup
I create a swift framework which include C library (CommonCrypto) and a Objective C file.
There is no bridge-header in swift project. So I create a module.modulemap
to import CommonCrypto and Objective-C file into my swift framework.
Here is the module.modulemap sample link:Importing CommonCrypto in a swift framework
In project settings, adding modulus.modulusmap path to swift compile
So, in my swift framework, everything works fine. I can use modulus like this
Problem shows
Archive the modular framework and export as a built products.
In my swift sample project, add modular framework to Embedded Binaries
Error occurs on this line when I use something inside the framework
I have try so many solutions, but still not work.
Similar problems:
Is anyone have a good solution for this? Thx!!
Solution
iOS framework exists as a folder, create a module.modulemap
to find out library or header file.
Setup module.modulemap
path
In project/target/Build Settings/Swift Compile - Search Path/Import Path = “${SRCROOT}”
Add below to module.modulemap
Remarks
You don't have to add module.modulemap to the sample project if the framework is archived on the same development environment.