I have a XCFramework which depends upon several other Static Frameworks. All of those sub frameworks are built with BUILD_FOR_LIBRARIES_FOR_DISTRIBUTION enabled. The sub frameworks don't need to be accessible from outside the XCFramework. When I try to compile my XCFramework in the client app, I am getting errors on the
import Core, which is the XCFramework's swiftinterface file, for one of the sub frameworks.
/Users/paulossenbruggen/Library/Developer/Xcode/DerivedData/DemoProject-dnxwshtlynfbgcdviialmdfrdwwa/Build/Products/Debug-iphonesimulator/Core.framework/Modules/RideCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:4:8: No such module 'AwaitKit' /Users/paulossenbruggen/Projects/DemoProject/DemoProject/GPSLocationComponent.swift:9:8: Failed to load module 'Core' /Users/paulossenbruggen/Projects/DemoProject/Carthage/Build/iOS/Core.framework/Modules/Core.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:4:8: No such module 'AwaitKit'
What seems to be missing is the swiftinterface files for the dependent modules. For example, I am using AwaitKit but the swiftinterface is not there within the XCFramework. With
nm I can see that the objects for AwaitKit are there, but when processing the import in the Core swiftinterface file it produces an error.
So, what is unclear is can I just copy the AwaitKit swiftinterface somewhere in the xcframework? And if so where? Is there a way to tell xcbuild -xcframework tool to include the swiftinterface files for dependent libraries? Or perhaps there is something else I should be doing that I am not doing?
For reference this is how the XCFramework are being built. The BUILD_LIBRARIES_FOR_DISTRIBUTION flag is being set in the project setting and the dependent libraries are also defined in the project file:
TEMP_DIR=archive rm -rd "RideCore.xcframework" xcodebuild archive -scheme Core -destination "generic/platform=iOS" -archivePath "$TEMP_DIR/Core.iOS.xcarchive" SKIP_INSTALL=NO -sdk iphoneos xcodebuild archive -scheme Core -destination "platform=iOS Simulator,name=iPhone 11" -archivePath "$TEMP_DIR/Core.iOS-simulator.xcarchive" SKIP_INSTALL=NO -sdk iphonesimulator xcodebuild -create-xcframework -framework "$TEMP_DIR/Core.iOS.xcarchive/Products/@executable_path/Frameworks/Core.framework" -framework "$TEMP_DIR/Core.iOS-simulator.xcarchive/Products/@executable_path//Frameworks/Core.framework" -output "Core.xcframework"