Swift
Running Swift-language builds and doing Swift development is possible on Linux.
According to Wikipedia:
- Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. and the open-source community. First released in 2014, Swift was developed as a replacement for Apple's earlier programming language Objective-C, as Objective-C had been largely unchanged since the early 1980s and lacked modern language features.
Installation
Install swift-binAUR for the released version, which is a repackaged Fedora binary, or swift-languageAUR for a native build from source.
Use swift-language-gitAUR for the development version.
For code completion the sourcekit language server protocol, sourcekit-lsp is available, e.g. as plugin to visual studio code, code. See below.
Hello world
The Swift package manager allows to create example programs.
$ swift package init --type executable $ swift run
For a library:
$ swift package init $ swift build
Read eval print loop, REPL
For details on the swift REPL, see here.
$ swift
Welcome to Swift version 5.3 (swift-5.3-RELEASE). Type :help for assistance. 1> 1+1 $R0: Int = 2 2>
gollark: `Shreya looks at the Arduino code on the machine and breaks up the structure inside her forever loop`
gollark: ... why block discord messages?
gollark: https://twitter.com/ChrisWilde78 ← might as well just look at it, it's funny.
gollark: Oops, oh well.
gollark: `[REDACTED] Wilde RetweetedTesVerified account @tesFeb 10We learn from each other. So, I’m less a teacher, more a facilitator, writes @ChrisWilde78 as he tells you how you can also teach through play @LEGOEDUCATION (sponsored)`
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.