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

前端之家收集整理的这篇文章主要介绍了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相关文章