Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

ios - Module compiled with Swift 3.0 cannot be imported in Swift 2.3

This is what I do:

import BSTableViewReorder

and get the following error:

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

Using Xcode 8 and macOS Sierra.

For Both: the target and the project I have the following settings of Use Legacy Swift Language Version

enter image description here enter image description here

The project is my pod for cocoapods dependencies. I just converted project to Swift 3.0 but it does not compile.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You'll need to change the Use Legacy Swift Language Version to NO - this makes sure your project will use 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...