Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Swift Introduction/Introduction

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Introduction What is Swift? Swift is an open source programming language, introduced by Apple in 2014. It is used for their operating systems macOS for desktops and iOS for mobile devices, for instance iPhone or iPad. Since 2015 Swift has also been available on Linux under the Apache Licence 2.0Apache Software Foundation [online][accessed: 18.09.2017] | https://www.apache.org/licenses/LICENSE-2.0. It is a modern language that includes multiple paradigms like object orientation, functional- and imperative programming. Apple included useful features from other languages like C#, Ruby, Python or Haskell. Swift on Linux Install Before you can start with Swift, you first have to download and install the compiler and other componentsSwift.org [online][accessed: 18.09.2017] | https://swift.org/getting-started/. Those can be downloaded from Swift's download page. On Linux, clangclang [online][accessed: 18.09.2017] | https://clang.llvm.org has to be installed too using following command: $ sudo apt-get install clang IDE for Linux Xcode is only available on macOS. However, there are alternatives which provide similar functionality: JetBrain's CLion offeres a Swift extension which features code highlighting and completion and also a debuggerJetBrain Swift Plugin [online][accessed: 18.09.2017] | https://blog.jetbrains.com/clion/2015/12/swift-plugin-for-clion/. The Open-Source Editor Atom offeres a plugin that works similar to Xcode's playground where you can easily try new code and immediately see what it doesAtom.io Swift Playground [online][accessed: 18.09.2017] | https://atom.io/packages/swift-playground. First example Before we dive right into Swift's basic and advanced features, let's have a look at the world-famous "Hello World" example. print("Hello World") Now, let's have a first glance at what variables and constants look like. var name: String = "John" let greeting: String = "Welcome to the world of Swift, " print(greeting + name) // Welcome to the world of Swift, John References