sh
archive iPhone 64
xcodebuild archive -workspace ./UnitTestWithPod.xcworkspace -scheme UnitTestWithPod -arch arm64 -configuration Release SKIP_INSTALL=NO -sdk "iphoneos" BUILD_LIBRARY_FOR_DISTRIBUTION=YES OTHERCFLAGS="-fembed-bitcode" -archivePath ./archives/ios.xcarchive
archive simulator arm64 M1
xcodebuild archive -workspace ./UnitTestWithPod.xcworkspace -scheme UnitTestWithPod -arch arm64 -configuration Release SKIP_INSTALL=NO -sdk iphonesimulator BUILD_LIBRARY_FOR_DISTRIBUTION=YES OTHERCFLAGS="-fembed-bitcode" -archivePath ./archives/sim64.xcarchive
archive simulator x86_64
xcodebuild archive -workspace ./UnitTestWithPod.xcworkspace -scheme UnitTestWithPod -arch x86_64 -configuration Release SKIP_INSTALL=NO -sdk iphonesimulator BUILD_LIBRARY_FOR_DISTRIBUTION=YES OTHERCFLAGS="-fembed-bitcode" -archivePath ./archives/simx86.xcarchive
xcodebuild -create-xcframework \framework "./archives/ios.xcarchive/Products/Library/Frameworks/UnitTestWithPod.framework" \
framework "./archives/sim64.xcarchive/Products/Library/Frameworks/UnitTestWithPod.framework" \
framework "./archives/simx86.xcarchive/Products/Library/Frameworks/UnitTestWithPod.framework" \
output "./archives/UnitTestWithPod.xcframework"
As a result
sh
Both ios-x86_64-simulator and ios-arm64-simulator represent two equivalent library definitions.
I have also tryied lipo to create fat framework for this sim64 and simx86 and then create xcframework. xcframework has beed generated.
I was able to run on arm64 simulator (m1)
arm64 device
But I was NOT able to run on x86 simulator with error
sh
'xyz' lib is unavailable: cannot find swift declaration for this class