Xcode 在 Swift 2.2 和 Swift 3.0 之间切换 [英] Xcode switching between Swift 2.2 and Swift 3.0

查看:25
本文介绍了Xcode 在 Swift 2.2 和 Swift 3.0 之间切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我下载了新的 Xcode 并转换/更新了我的语法后,Xcode 就在上面提到的 Swift 版本之间随机切换.我在终端中运行了swift -version",它(目前)确认我正在运行 Swift 2.2

我看到了这个问题(

Ever since I downloaded the new Xcode and converted/updated my syntax, Xcode has been randomly switching between the above mentioned versions of Swift. I ran 'swift -version' in my Terminal and it confirmed (for the moment) that I am running Swift 2.2

I saw this question (Swift compiler is confusing version 2 and 3) but I'm too new to add a comment and ask more questions (like why can't I find that in the targets section of my project?).

How can I set my syntax so that it stays on Swift 3 and doesn't change without warning? This will be about the fourth time I've updated everything for the sake of testing/running my app.

Hopefully this is an issue for other people and this question helps them too - I feel awful asking when I'm new. I hope to be able to know enough to help other users soon.

解决方案

You can set Swift in the Terminal to be the same version as Xcode 8's with xcode-select. Point it at Xcode beta like this:

sudo xcode-select --switch /Applications/Xcode-beta.app

You can also set the toolchain right in Xcode 8, in menu Xcode > Toolchains > Manage Toolchains:

这篇关于Xcode 在 Swift 2.2 和 Swift 3.0 之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆