We have a Chat API framework. We provide .framework file through cocoapods as we don't want to show the code. Problem we faced that we have to create .framework file for each Xcode version as each Xcode has different compiler version
11.0 => 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
11.1 => 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
11.2 => 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)
11.3 => 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
11.3.1 => 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
11.4 => 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
11.4.1 => 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
When we try to import framework build with Xcode 11.4 in Xcode 11.0, it gives error "Module compiled with Swift Version 5.2 compiler cannot be imported in compiler version 5.1
Any Solution for this as we can not ask our clients to change Xcode Versions.
you can distribute you framework via XCFramework, it was introduced on WWDC19.
Code to create XCFramework is as bellow,
Create an archive for iOS platform
xcodebuild archive -workspace {YourWorkspace}.xcworkspace \
-scheme {Scheme} \
-sdk iphoneos \
-archivePath "./archives/ios_devices.xcarchive" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO | xcpretty
Create an archive for iOS-Simulator platform
xcodebuild archive -workspace YourWorkspace.xcworkspace \
-scheme {Scheme} \
-sdk iphonesimulator \
-archivePath "./archives/ios_simulators.xcarchive" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO | xcpretty
Create an XCFramework from Archives
xcodebuild -create-xcframework \
-framework ./archives/ios_devices.xcarchive/Products/Library/Frameworks/{Your Framework}.framework \
-framework ./archives/ios_simulators.xcarchive/Products/Library/Frameworks/{Your Framework}.framework \
-output build/{Your Framework}.xcframework | xcpretty