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.

Community
  • 1
  • 1
jlp28
  • 53
  • 1
  • 10

1 Answers1

7

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:

enter image description here

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
  • Thanks for your response - I don't know why, but I don't have Toolchains in my preferences menu. I have the first two, but not the third. Is there something inherently wrong with my Xcode or something?! I just triple checked, and I'm running Xcode 8.0. – jlp28 Jul 05 '16 at 13:13
  • Very weird! Anyway, try with the Terminal command, it should work - that's what I use on my office machine. – Eric Aya Jul 05 '16 at 13:19
  • 1
    It's not there (should probably look into that) but I tried the other method and it appears to have worked! Thanks so much – jlp28 Jul 05 '16 at 13:33
  • 2
    Toolchains were removed from Xcode by default. It will appear again after installing the desired Snapshot from swift.org https://swift.org/download/#snapshots – Robin Sep 15 '16 at 12:43