LoginSignup
1
1

More than 5 years have passed since last update.

Swift:Swiftのバージョンを調べる

Last updated at Posted at 2017-08-25

macOS Sierra(10.12.6)
Xcode 8.3.3
Swift version 3.1
を使用しております。

上記のように書こうとしたり
たまにドキュメントを書く時に使っているSwiftのバージョンを記載しておこうと思ったら
Swiftのバージョンがわからなかった。

Macは「このMacについて」、Xcodeは「About Xcode」でバージョンを調べられますが
Swiftはそんなものはなく、調べるとターミナルで
swift -v
と、入力すると表示されると書いてあり

xxxxxx:~ xxxx$ swift -v
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9
/Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics"
Welcome to Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42). Type :help for assistance.

のように表示され、最後に

xxxxxx:~ xxxx$ swift -v
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9
/Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics"
Welcome to Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42). Type :help for assistance.
  1>

1>
と、なって入力待ちに。
ここで、
:exit
とタイピングして終了させます。

ですが、
:q
でも終了できます。

何か面倒。バージョンだけ調べたいのであれば
swift -version
で、OK。

xxxxxx:~ xxxx$ swift -version
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9
xxxxxx:~ xxxx$

先程のように最後に入力して終了させるとか必要なくバージョン表示されます。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1