How can I update swift from 3.1 to 3.2, but not to 4.0

只愿长相守 提交于 2019-12-01 03:16:31

Swift 3.2 is a stopgap solution to continue using Swift 3 code under Xcode 9 without fully converting projects to Swift 4.

The Swift version included in Xcode 8.3.3 is 3.1. Converting your code to Swift 3.2 under Xcode 9 does not guarantee that it will still compile under Xcode 8.

I'm not sure compiling Swift 3.1 code as Swift 3.2 under Xcode 9 requires any conversion at all, since they both share the same syntax. You may have to fix some API calls to compensate for changes in the new SDKs.

Apple has a little more information here:

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Compatibility.html

(updated)

Regarding your last image, if you have the source code for the Runes module, you'll have to recompile it under Xcode 9. That will make use of Swift 3.2 and allow it to be imported in Swift 4.

You can try this:

  • Build Settings -> Swift Langauge Version -> Swift 3.2.

  • Edit -> Convert -> To Current Swift Syntax.

Noted: These step using Xcode 9

Dependency modules/ frameworks in swift have to be recompiled w/ xcode9 since swift is not ABI compatible/ stable. If you have included dependencies using package distribution systems like carthage or cocoa pods, the modules would be recompiled w/ xcode9 and you shouldn't see this issue. If you are linking packages built distributed in binary format, then you can run into the issue

You do not have to convert it.

Swift 3.2 is not an actual version. It is how Xcode 9 (and the Swift 4 compiler) calls Swift 3. (I guess to differentiate from Swift 3 built with Xcode 8).

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Compatibility.html

From Option Menu: Edit -> Convert -> To Current Swift Syntax

Above steps help you to convert into current swift syntax.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!