I hope that you heard about the Swift Programming Language. Here we will discuss that how to Getting started with Swift Programming on Ubuntu and How to install swift on ubuntu. If not the first question coming in you mind is “What is Swift ?“.
What is Swift ?
Recently Apple released their latest programming language, Swift. Swift is open Source. So, now anyone can use this on any system. Apple has made it easy to install and start Swift programming on Ubuntu. At this time we can install and run Swift for Ubuntu 14.04 or 15.10 (64-bit).
Swift is Apple’s newest programming language. It’s like an scripting language. Apple intended to replace Objective-C with Swift and make Swift the primary language for developing Mac OS X and IOS applications. Swift is very easy to learn and clean. It has a similar syntax to other popular programming languages.
So, now the next question is How to Install Swift on Ubuntu ?
To install Swift on Ubuntu follow this steps :-
- Open your terminal and login as root user for login as root you can use this command
this will ask for your password. Just enter your password and done
- Now we need to install required dependencies for Swift. For this run this command
PHP1sudo apt-get install clang libicu-dev
- Now download the swift for this use this command
PHP1wget -q -o - https://swift.org/builds/swift-2.2.1-release/ubuntu1404/swift-2.2.1-RELEASE/swift-2.2.1-RELEASE-ubuntu14.04.tar.gz
To install the latest version of Swift, visit the swift download page here and get the URL from there and use with this command. You just need to replace the path of tar.gz file.
- Now extract the file and move it to the /opt directory. For this run this command
PHP1mkdir /opt/swift/ && tar xvf swift-2.2.1-RELEASE-ubuntu14.04.tar.gz swift-2.2.1-RELEASE-ubuntu14.04/usr/ -C /opt/swift/
This will extract the files to /opt/swift/swift-2.2.1-RELEASE-ubuntu14.04
- Now we need to add Swift tool chain to our path. So we able to execute swift command from terminal. For this open your
~/.bashrc . To open file you this command
Now add below code into ~/.bashrc file.
You cam can now execute swift command to use the REPL or build Swift projects.