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.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...