Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler
OK, Turns out if you watch the WWDC video, they explain it:
https://developer.apple.com/videos/play/wwdc2019/416/
You need to set the Build Settings > Build Options > Build Libraries for Distribution option to Yes in your framework's build settings, otherwise the swift compiler doesn't generate the neccessary .swiftinterface
files which are the key to future compilers being able to load your old library.
This ends up in your project.pbxproj file as:
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
After setting this flag, a framework I compiled using Xcode 11.0 (swift 5.1) was able to be used by Xcode 11.2 (swift 5.1.2) and everything appears to be working correctly.
Hopefully this question/answer will serve as a useful reference for everyone who hasn't watched all the WWDC videos
If the error still persists go to Product > Clean Build Folder and Build again.
Module compiled with Swift 5.5.1 cannot be imported by the Swift 5.5.2 compiler RazorPay
I fixed it by adding this code into my Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
Swift Module stability: Module compiled with Swift X.Y cannot be imported by the Swift X.Z compiler
You need Module Stability, not ABI stability.
The difference and the way how to achieve Module Stability, are described here: https://www.donnywals.com/what-is-module-stability-in-swift-and-why-should-you-care/
Here is WWDC session that explains swift binary frameworks (time code: 17:00).
Briefly, your framework
- should be built with
Build Libraries for Distribution
set toYes
- set the
Skip Install
property toNo
. - distributed as
.xcframework
with variants for simulator and device
You'll need to ensure that frameworks embedded into .xcframework
all have .swiftinterface
file inside of Modules/<name>.swiftmodule
folder.
Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler
This problem is caused by the fact that you attempt to embed a pre-compiled framework that was created with a different compiler version.
Currently, pre-compiled frameworks can only be embedded if the compiler versions match! The swift compiler version that is used to compile the project must be the same version that was used to compile the framework.
Hopefully, this restriction will be removed in future Swift / compiler versions...
For more information refer to the chapter on "Module Stability" here: https://swift.org/blog/abi-stability-and-more
As already mentioned in one of the comments, the solution to this problem is to up- or downgrade to the appropriate Xcode version. (Or, if possible, recompile the framework with the desired compiler version and then use the same compiler version for your project.)
Related Topics
How to Make a Rounded Oval Button
Uitapgesturerecognizer Called Immediately
Issue with Encoding "&" in Urls
Stream Data from Network in Avaudioengine, Is It Possible
Swift App Crashes on Real Device But Works on Simulator
How to Use Alamofires Servertrustpolicy.Disableevaluation in Swift 3
Swift Converting Signed Array of Int [Int8] to Unsigned Array of Int [Uint8]
Can't Dismiss Navigation Controller in Swift
Dynamically Passing Closure with Keypaths to a Sorting Function
My Reachability Notifier Is Only Able to Be Called Once
Saving an Image to Photos Library Using Swift 2.0
Xcode 6 Ignoring Breakpoints - Swift
Get "No Keychain Available" Error When Try to Access Keychain from App Extension
iOS Swift Remove Uitableview Cell Separator Space
Collectionview Flowlayout Overlapping When Scrolling Not Working
The Meaning of "Withevent" in Swift, and Parameter Modifiers in General