如何在 Xcode 9.3 中切换到 Swift 4.0?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49667188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I switch to Swift 4.0 in Xcode 9.3?
提问by Vladyslav Zavalykhatko
采纳答案by bcr
Make sure you have updated xCode then under Build Settings, check the drop down options for Swift Compiler - Language.
确保您已更新 xCode,然后在 Build Settings 下,检查 Swift Compiler - Language 的下拉选项。
Furthermore, You can download Xcode 8.x and 9.x from Apple Download Portal, if you've premium developer account (apple id). You can install & work with both Xcode 9 and Xcode 8.x in single (mac) system. (Make sure you've Command Line Tools supporting both version of Xcode, to work with terminal)
此外,如果您拥有高级开发者帐户 (apple id),则可以从Apple 下载门户下载 Xcode 8.x 和 9.x。您可以在单个 (mac) 系统中安装和使用 Xcode 9 和 Xcode 8.x。(确保您的命令行工具支持两个版本的 Xcode,以使用终端)
回答by Artem
I was able to install swift 4.0 in XCode 10 with solution from here "Switching Swift Versions inside Xcode using Toolchains".
我能够使用“使用工具链在 Xcode 中切换 Swift 版本”的解决方案在 XCode 10 中安装 swift 4.0 。
But in the end this did not help. I stuck on error:
但最终这并没有帮助。我坚持错误:
< unknown>:0: error: unknown argument: '-enable-batch-mode'
<未知>:0:错误:未知参数:'-enable-batch-mode'
Even disablingnot helped. I got:
即使禁用也无济于事。我有:
< unknown>:0: error: unknown argument: '-disable-batch-mode'
<未知>:0:错误:未知参数:'-disable-batch-mode'
"Switching Swift Versions inside Xcode using Toolchains"shortly:
- Download desired toolchain, and click to install.
- Select new toolchain in XCode Preferences.
- Use desired swift, beware caveats.
- 下载需要的工具链,点击安装。
- 在 XCode 首选项中选择新工具链。
- 使用所需的 swift,注意警告。
Another related: material.
另一个相关:材料。