How to Install Swift on Fedora 36 Linux

Swift, often referred to as “Objective-C, without the C,” is an open-source programming language developed and maintained by AppleSwift is a general-purpose programming language built using modern safety, performance, and software design patterns. The Swift project aims to create the best available language for systems programming to mobile and desktop apps, scaling up to cloud services.

In the following tutorial, you will learn how to install Swift Programming Language on your Fedora 36 workstation or server along with connecting to the terminal instance, maintaining and, if need be, removing Swift from your Fedora system.

Update Fedora

Before you continue, your system is advised to ensure all existing packages are up to date to avoid system conflicts during the installation and good system maintenance.

sudo dnf upgrade --refresh -y

Install Swift Programming Language

By default, Swift is available in Fedora’s repositories. Given Fedora is a six-month release nearly always has the most up-to-date version of Swift available compared to other distributions where it’s outdated or does not exist at all, making the installation a fast process.

First, install Swift with the dnf install command as below.

sudo dnf install swift-lang -y

Connect to Swift REPL

To connect to the Swift REPLL (Read Eval Print Loop) can be achieved using the following command:

swift

You can write valid Swift statements in this terminal and see them evaluated, and you can even use standard C Libraries by importing the GNU C Libary.

Below are some basic examples of Swift in action:

let name = "Joshua James"
import Glibc // imports GNU C Library
var ln = random () % 100
print("Thank You LinuxCapable.com for learning how to Install Swift on Fedora 36")

Example in terminal:

How to Install Swift on Fedora 36 Linux

To exit the Swift terminal, use the following command:

:q

How to Update Swift Programming Language

For updates to Swift Programming language, use the standard refresh update command in your terminal as you would with your standard system packages.

sudo dnf update --refresh

How to Remove (Uninstall) Swift Programming Language

Removing the language is relatively easy for users who no longer require Swift on their Fedora system since it was installed using the dnf package manager.

In your terminal, execute the following command:

sudo dnf autoremove swift-lang -y

Comments and Conclusion

In the tutorial, you have learned how to install Swift programming language on Fedora 36 Linux workstation or server.

Swift is a powerful programming language that can develop apps for Apple products. It has been open-sourced, which is free and available to the public. This makes Swift an attractive option for developers who want to create apps for multiple platforms. Swift offers many benefits over other languages, such as Objective C. Its syntax is simpler and more concise, making it easier to learn and use. Additionally, Swift code runs faster than Objective C code. These factors make Swift a desirable choice for app development, and the language is still evolving, and new features are being added all the time. The language continues to grow in popularity, and its future looks bright.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!