I'm attempting to create a proof of concept of a static library, distributed as an XCFramework, which has two local XCFramework dependencies.
The reason for this is because I'm working to provide a single statically linked library to a customer, instead of providing them with the static library plus the two dependencies.
The Issue
With a fairly simple example project, I'm not able to access any code from the static library without the complier throwing a "No such module" error and saying that it cannot find one of the dependent modules.
Project Layout
I have an example project that has some example targets with basic example code.
Target: FrameworkA
- Mach-0 Type: Dynamic
- Build Mergable Library: Yes
- Skip Install: No
- Build Libraries For Distribution: Yes
Target: FrameworkB
- Mach-0 Type: Dynamic
- Build Mergable Library: Yes
- Skip Install: No
- Build Libraries For Distribution: Yes
XCFrameworks are being generated from these two targets using Apple's recommendations. I've verified that the mergable metadata is present in both framework's Info.plist files.
Each exposes a single struct
which will return an example String
.
Finally I have my SDK target:
Target: ExampleKit
- Mach-0 Type: Static
- Build Mergable Library: No
- Create Merged Binary: Manual
- Skip Install: No
- Build Libraries For Distribution: Yes
The two .xcframework
files are in the Target's folder structure as well. The "Link Binary With Libraries" build phase includes them and they're Required
.
Inside of the ExampleKit target, I have a single public struct
which has two static properties which return the example strings from FrameworkA
and FrameworkB
.
I then have another script which generates an XCFramework from this target.
Expectations
Based on Apple's documentation and the "Meet Mergable Libraries" WWDC session I would expect that I could make a simple iOS app, link the ExampleKit.xcframework
, import ExampleKit
inside of a file, and be able to access the single public struct present in ExampleKit
. Unfortunately, all I get is "No such module FrameworkA".
I would expect that FrameworkA and FrameworkB would have been merged into ExampleKit? I'm really unsure of where to go from here in debugging this. And more importantly, is this even a possible thing to do?