Swift is a programming language developed by Apple Inc. for iOS, macOS, watchOS, tvOS, and Linux at the WWDC 2014. It shares a few similarities with Kotlin, which is now officially supported from Google for Android Development. Because it’s a general purpose language you can even use Swift for Web Development. And because you can use it on linux, i wanted play around with it. Here is my instruction how to run it on Ubuntu 16.04.

Be aware of that you can not build iOS apps with it, because you still need a Mac and XCode.

How to install it?

1) Download a Snapshot

Download a snapshot from Apple of the Swift version that you want to run and the Ubuntu version you are running. I took THIS

2) Extract it

3) Create an environment path

You don’t have to do this, but then you can easily run the command “swiftc” without specifying the full path to your swift version.

Open your .bashrc:

Add the path:

You need to change it to the folder that contains your swift version

Save and reload the .bashrc:

4) Test the compiler

To test if everything is fully working, create a new text file “hello.swift”.
Write and save in it:

This is a “Hello World” program in Swift

Now open a terminal and run:

If everything works correct the swift compiler will create a file called “hello”.

swiftc in terminal

swiftc in terminal

Run the hello file from a terminal and it will print:
Hello World!