ios – 库的版本之间的Swift兼容性

我正在为其他开发人员分发库( http://empiric.al).我注意到在swift版本之间,甚至是2.0到2.1之间,我会得到模块文件是由编译器的(更新/更旧版本)创建的.

我需要以面向未来的方式进行分发.

我怎样才能确保将来我的编译框架可以被更新版本的Swift使用,所以我不必在Apple推出新测试版后立即重新编译?

解决方法

从 Apple’s website开始:

Binary Compatibility and Frameworks

While your app’s runtime compatibility is ensured,the Swift language
itself will continue to evolve,and the binary interface will also
change. To be safe,all components of your app should be built with
the same version of Xcode and the Swift compiler to ensure that they
work together.

This means that frameworks need to be managed carefully. For instance,if your project uses frameworks to share code with an embedded extension,you will want to build the frameworks,app,and extensions together. It would be dangerous to rely upon binary frameworks that use Swift — especially from third parties. As Swift changes,those frameworks will be incompatible with the rest of your app. When the binary interface stabilizes in a year or two,the Swift runtime will become part of the host OS and this limitation will no longer exist.

以上是来客网为你收集整理的ios – 库的版本之间的Swift兼容性全部内容,希望文章能够帮你解决ios – 库的版本之间的Swift兼容性所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。