Recently I created a iOS Framework called "MLKit Framework" that uses MLKit Face Detection library. In order to achieve that, I just imported the library in Podfile according to documentation.
As expected, that created a xcworkspace called MLKit Framework. In order to test that new framework, I created an app called MLKitApp and added that app to the same workspace. Then I added the framework MLKitFramework to that app and tried to build it but I get the error statement: "Missing required module 'MLKit'" as the image below.
Why Am I getting that error? What I'm doing wrong?
Reproducible Example
I created a Reproducible Example here. In order to execute that example execute the following:
And voilà
The issue you're encountering is a result of Google's decision to conceal the MLKit header for the primary module. To resolve this problem, you can opt to import the standalone libraries individually, rather than importing the main module as a whole.
To rectify the situation, replace your current imports like import MLKitFramework
or import MlKit
with the specific modules you intend to utilize. Here's an example of how you can modify your imports:
import MLKitCommon
import MLKitFaceDetection
import MLKitVision
...
Besides fixing your problem, by importing these individual modules, you also gain more control and transparency over which MLKit components you include in your project. This way, you can fine-tune your dependencies and ensure that only the necessary components are included, potentially reducing the overall footprint of your application and avoiding conflicts or hidden headers.