In the next article we will take a look at how can we install Swift on Ubuntu 20.04. This is the name of Apple’s programming language, with which we can create applications for Mac OS X and IOS. As this this language uses a combination of different popular programming languages, it is relatively easy to learn.
At first, Swift was only available for Apple devices and could not be used on Gnu / Linux, Windows, and other operating systems. As time went by, its popularity grew and users asked Apple to launch Swift on other platforms. In the end they ended up deciding that Swift would be open source.
Swift is a functional, multi-pattern, object-oriented language that was designed by Chris Lattner to troubleshoot Objective-C. This language also accesses older code written in Objective-C. The main objective of developing this language is to increase security, correct errors and short codes. Thanks to the compiler in Xcode, developers can easily create their own applications.
Swift general features
- Speed is an important and differential characteristic of language Swift programming.
- In general, this programming language stands out compared to other previous developments for being safer, faster and with which we can obtain better results.
- Swift’s security is mainly based on the lower probability of making mistakes while typing. By being based on cleaner code, with a variable structure less prone to errors and with automatic management, the existence of errors or problems should be less.
- A programming language without errors or less likely to appear, has the consequent advantage that digital development based on this code is also more stable. In consecuense, apps in Swift are more secure than those created with other programming languages.
- You have to understand that its existence derives from the need to improve or even replace languages such as Objective-C.
- Today, Swift remains the fastest programming language that can be used for any development on iOS.
- When a variable encounters null and null errors, programmers prevent the application from crashing by placing a question mark in the code structure.
- Something to highlight among its characteristics is its constant evolution. In fact, this language is so recent because it is presented as an evolution of the rest of the programming languages prior to it. Following this philosophy, Swift continues to evolve continuously, thus taking better advantage of the advances of new technologies and allowing more and more complex and functional developments for users.
Install Swift on Ubuntu 20.04
To install Swift in Ubuntu, we will only have to follow the steps that will be shown below. The first step to follow will be add the necessary dependencies before starting the installation. To do this we only need to open a terminal (Ctrl + Alt + T) use the following command:
sudo apt install clang libpython2.7 libpython2.7-dev
After installing the necessary dependencies, we will download swift. To do this, in the same terminal we can use wget in the following way:
Once the download is finished, we will extract tar file using the following command:
tar xzf swift-5.3-RELEASE-ubuntu20.04.tar.gz
The next step will be move the contents of the extracted file to the ‘share’ directory:
sudo mv swift-5.3-RELEASE-ubuntu20.04 /usr/share/swift
At this point, we will have to set Swift’s path to the system PATH environment variable using the following command. In case of using zshrc we can change the end of the commands to ~ / .zshrc.
echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc source ~/.bashrc
After the installation, we can check version executing this command, with which we will know that it was installed correctly:
We can also run the mythical program “Hello World” which should be tested in all languages, to verify that it works correctly:
print(“Prueba para Ubunlog”)
Swift is the name of Apple’s open source programming language, which you can use on any operating system. For more information on this language, we can visit the documentation that they have published on the project website.