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

后端 未结 15 1280
失恋的感觉
失恋的感觉 2020-11-28 17:20

I just created a new Swift project within Xcode. I am wondering which version of Swift it\'s using.

How can I see, in Xcode or the terminal, what version of Swift I

15条回答
  •  醉话见心
    2020-11-28 18:00

    To see the default version of swift installed on your machine then from the command line, type the following :

    swift --version
    

    Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)

    Target: x86_64-apple-darwin17.6.0

    This is most likely the version that is included in the app store version of Xcode that you have installed (unless you have changed it).

    If you want to determine the actual version of Swift being used by a particular version of Xcode (a beta, for instance) then from the command line, invoke the swift binary within the Xcode bundle and pass it the parameter --version

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

    Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3)

    Target: x86_64-apple-darwin17.6.0

提交回复
热议问题