This tutorial will help you to install swift programming language on your Ubuntu and Debian system.
Step 1 – Prerequisites
Login to your Ubuntu system using SSH (Shell) access. Now install the required dependencies for swift installation on your system. On a fresh Ubuntu 16.04 install, I also needed to install following packages to work swift properly.
Step 2 – Install Swift Ubuntu 16.04
First, import the swift GPG keys to validate packages on your system. This will help you to verify archive signature file. Now download the latest available swift release from its official site. You can use below command to download Swift 4.0.3 on Ubuntu 16.04 system. Also, configure the swift binary to system’s PATH environment variable.
Step 3 – Check Swift Version
Use the following commadn to check the current instaled Swift version on your system.
Step 4 – Swift REPL Examples
Just type swift on your system console and you will get Swift console. You can use this console for quick operations and for the learning purpose.
Below example will store a single string in a variable and print the variable value using the Swift console.
Also, do some mathematical operations using Swift console.