I want to have some XCFrameworks into an umbrella framework or umbrella xcframework using Xcode 12.4 for iOS. I tried all the approaches mentioned in these threads. However, I am not able to get it working for any of the swift classes in my client app.
Note that this works seamlessly with ObjC classes.
XCFramework with static frameworks sub dependencies
Approach 1 - Create .framework
When I build a .framework by adding sub xcframeworks to copy framework build phase, I see that xcframework subprojects are extracted to static libraries ".a" files. I import this .framework in my application which is ObjC + Swift, I get "No such modules" error for all the subprojects in all the swift classes which imports the umbrella framework
Approach 2 - Create .xcframework
When I create a .xcframework with all xcframework sub projects, I get No such module 'XXXX' error in x86_64-apple-ios-simulator.swiftinterface when I use the umbrella framework in the client app
Note that I am linking and embedding the umbrella / xcframework in client app.
Another Thought
Also, when I create a sample app with Xcode 12.4 and import the same umbrella framework/.xcframework, everything works fine. Is this something to do with the client app .xcodeproj created in older versions of XCode ?
Some things to try:
Make sure to have BUILD_LIBRARY_FOR_DISTRIBUTION
set.
Link the sub frameworks statically. If you are including the other frameworks using CocoaPods, make sure you specify use_frameworks! :linkage => :static
.
In your source files where you use the sub-frameorks, write @_implementationOnly import SomeFramework
.