How to tell what version of Swift Xcode is using

Sometimes we need to check what version of Swift we are using, or, more correctly what version of Swift Xcode is using. There are two ways that we can do this, one is more accurate if you want more than just the major version.

Finding Swift version using the terminal

This is the most accurate way and it is quite easy:

/Applications/{THE XCODE VERSION YOU WANT TO CHECK}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --version

So, if we look at the above command and want to check the Swift version used for the default Xcode app we can update it to look like the following:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --version

If you want to check the version of Swift that Xcode-beta is using, we can using the following:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --version

And so on. If you have other versions of Xcode, or you have renamed Xcode, then you need to use the name that you have given Xcode in the above command.

Finding Swift version using Xcode

  1. Go to the Project Navigator
  2. Click on your project
  3. Click on your project under Targets
  4. Click on Build Settings
  5. Search for Swift
  6. Look for Swift Compiler - Language, it should have a property called Swift Language Version

You can see the above path in the below image: