How to Install Swift on Mac OS?

Step 1: Download the installer and its components. To download, please use this link:
https://swift.org/download/

Step 2: The package file is downloaded in the Downloads folder. The file can be installed by the installer command on the terminal.

$ $ sudo installer ?pkg downloads/swift-4.0.3-release-osx.pkg -target /

Step 3: To check, which version of Swift is installed on our computer, we have to just type swift -version.