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

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


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:

/Applications/Xcode.app/...

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.


Project build settings have a block 'Swift Compiler - Languages', which stores information about Swift Language Version in key-value format. It will show you all available (supported) Swift Language Version for your Xcode and active version also by a tick mark.

Project ► (Select Your Project Target) ► Build Settings ► (Type'swift_version' in the Search bar) Swift Compiler Language ► Swift LanguageVersion ► Click on Language list to open it (and there will be a tick mark on any one of list-item, that will be current swift version).

Look at this snapshot, for easy understanding:

xcode with described areas highlighted


With help of following code, programmatically you can find Swift version supported by your project.

#if swift(>=5.3)print("Hello, Swift 5.3")#elseif swift(>=5.2)print("Hello, Swift 5.2")#elseif swift(>=5.1)print("Hello, Swift 5.1")#elseif swift(>=5.0)print("Hello, Swift 5.0")#elseif swift(>=4.2)print("Hello, Swift 4.2")#elseif swift(>=4.1)print("Hello, Swift 4.1")#elseif swift(>=4.0)print("Hello, Swift 4.0")#elseif swift(>=3.2)print("Hello, Swift 3.2")#elseif swift(>=3.0)print("Hello, Swift 3.0")#elseif swift(>=2.2)print("Hello, Swift 2.2")#elseif swift(>=2.1)print("Hello, Swift 2.1")#elseif swift(>=2.0)print("Hello, Swift 2.0")#elseif swift(>=1.2)print("Hello, Swift 1.2")#elseif swift(>=1.1)print("Hello, Swift 1.1")#elseif swift(>=1.0)print("Hello, Swift 1.0")#endif

Here is result using Playground (with Xcode 11.x)

enter image description here


Open the Terminal and write:

swift -version