使用Swift 3.0编译的模块无法在Swift 2.3中导入 [英] Module compiled with Swift 3.0 cannot be imported in Swift 2.3
问题描述
这就是我的工作:
import BSTableViewReorder
并收到以下错误:
使用Swift 3.0编译的模块无法导入在Swift 2.3中
Module compiled with Swift 3.0 cannot be imported in Swift 2.3
我可以做些什么来使它编译?我做了:
What can I do to make it compile? I did:
Edit > Convert -> Current Swift Syntax
使用Xcode 8和macOS Sierra。
对于两者:目标和项目我有以下设置使用Legacy Swift语言版本
For Both: the target and the project I have the following settings of Use Legacy Swift Language Version
该项目是我的cocoapods依赖项的pod。我刚刚将项目转换为Swift 3.0但它没有编译。
The project is my pod for cocoapods dependencies. I just converted project to Swift 3.0 but it does not compile.
推荐答案
你需要更改使用Legacy Swift语言版
到否
- 这可确保您的项目将使用swift 3.
You'll need to change the Use Legacy Swift Language Version
to NO
- this makes sure your project will use swift 3.
如果要将项目打包为POD(对于cocoapods),则需要添加名为.swift-version的文件(包含1行,3.0)。
这将告诉cocoapods使用swift 3编译器。
If you want to package your project as a POD (for cocoapods) you'll need to add a file named .swift-version (containing 1 single line, "3.0"). This will tell cocoapods to use the swift 3 compiler.
此更改后一切都应该有效。
Everything should work after this changes.
这篇关于使用Swift 3.0编译的模块无法在Swift 2.3中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!