David Snabel David Snabel - 1 year ago 60
iOS Question

How do I see which version of Swift I'm using in Xcode?

I just created a new Swift project within Xcode. I am wondering which version of Swift it's using. Is there a way to see within Xcode which version of Swift it's using? Or is there some sort of function I could call to get the Swift version?


What I do is say in the Terminal:

$ xcrun swift -version

Output for Xcode 6.3.2 is:

Apple Swift version 1.2 (swiftlang-602.0.53.1 clang-602.0.53)

Of course that assumes that your xcrun is pointing at your copy of Xcode correctly. If, like me, you're juggling several versions of Xcode, that can be a worry! To make sure that it is, say

$ xcrun --find swift

and look at the path to Xcode that it shows you. For example:


If that's your Xcode, then the output from -version is accurate. If you need to repoint xcrun, use the Command Line Tools pop-up menu in Xcode's Locations preference pane.