I am using RxCocoa in custom framework, so I am trying to inject dependencies with SPM and make that .xcframework. I made the .xcframework, but the following error keeps appearing.
The process of creating and configuring the framework project and creating the xcframework was as follows.
Development Environment
- CPU : Apple slicon (M1 PRO)
- MacOS : Ventura 13.1
- Xcode : 14.2(14C18)
Step
- Create framework project (km-ios-sdk)
- Set Build Active Architecture Only YES from NO
- Mach-O Type is Dynamic Library
- Write simple code using RxSwift, RxCocoa
- Create .xcarchive and .xcframework
xcodebuild archive \
-scheme km-ios-sdk \
-archivePath ./archive/km-ios-sdk.framework-iphoneos.xcarchive \
-sdk iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
xcodebuild archive \
-scheme km-ios-sdk \
-archivePath ./archive/km-ios-sdk.framework-iphonesimulator-arm64.xcarchive \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
xcodebuild -create-xcframework \
-framework './archive/km-ios-sdk.framework-iphoneos.xcarchive/Products/Library/Frameworks/km_ios_sdk.framework' \
-framework './archive/km-ios-sdk.framework-iphonesimulator-arm64.xcarchive/Products/Library/Frameworks/km_ios_sdk.framework' \
-output './KmSDK.xcframework'
- Created Package.swift as below and uploaded it to git
- download and import km-ios-sdk as spm in the sample app, the error appears
- Missing required module 'RxCocoaRuntime'
After manually downloading RxCocoaruntime.xcframework from RxSwift Github and embedding it in the framework project, I made xcframework again, but the same error occurs.
Also, I added $(inherited) and $(BUILD_PRODUCTS_DIR)/RxCocoaruntime to Runpath and Framework Search Path in Build Setting, but the same error occurs.
Any solution?