[英]Swift Module stability: Module compiled with Swift X.Y cannot be imported by the Swift X.Z compiler
Let's start by existing questions,让我们从现有的问题开始,
Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler Swift 5.1.2 编译器无法导入使用 Swift 5.1 编译的模块
Module compiled with Swift 5.1 cannot be imported by the Swift 5.0 compiler Swift 5.0 编译器无法导入使用 Swift 5.1 编译的模块
Module compiled with Swift 5.1.2 cannot be imported by the Swift 5.2.4 compiler Swift 5.2.4 编译器无法导入使用 Swift 5.1.2 编译的模块
And, now with XCode 12(12A7209)而且,现在使用 XCode 12(12A7209)
Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler
Swift 5.3 编译器无法导入使用 Swift 5.2.4 编译的模块
The framework was compiled in the lower version of Swift (Swift 5.2.4).该框架是在较低版本的 Swift (Swift 5.2.4) 中编译的。 However, it worked perfectly with XCode 12 beta.
但是,它与 XCode 12 beta 完美配合。
Solution tried:尝试的解决方案:
Build Libraries for Distribution
to Yes
Build Libraries for Distribution
设置为Yes
Whole point is the Swift ABI stability for binary framework and how to achieve it across different swift version.重点是二进制框架的 Swift ABI 稳定性以及如何在不同的 Swift 版本中实现它。
Please advice.请指教。 Thank you in advance!
先感谢您!
You need Module Stability, not ABI stability.您需要模块稳定性,而不是 ABI 稳定性。
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/这里描述了如何实现模块稳定性的差异和方式: 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).这是解释 swift 二进制框架的WWDC 会议(时间代码:17:00)。
Briefly, your framework简而言之,您的框架
Build Libraries for Distribution
set to Yes
Build Libraries for Distribution
设置为Yes
Build Libraries for Distribution
.xcframework
with variants for simulator and device.xcframework
分发,带有模拟器和设备的变体You'll need to ensure that frameworks embedded into .xcframework
all have .swiftinterface
file inside of Modules/<name>.swiftmodule
folder.你需要确保嵌入到框架
.xcframework
都有.swiftinterface
的文件中Modules/<name>.swiftmodule
文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.