Last Updated on March 13, 2022 by Deya Eldeen
Swift is apple’s new open source programming language, that was introduced at Apple’s 2014 Worldwide Developers Conference (WWDC), it’s used to develop for iOS, macOS, watchOS and tvOS, mainly to work with Apple’s Cocoa and Cocoa Touch frameworks, it quickly became one of the fastest growing languages nowadays, hence open source under the Apache 2.0 license, other uses appeared including writing backend server side code using vapor framework.
The main focus with swift is to be concise, more expressive, fast and less prone to error (safer) than Objective-C, with modern features language.
The man behind swift is Chris Lattner, who worked at Apple Inc. as Director of the Developer Tools department, leading the XCode, Instruments, and compiler teams, and the main author of LLVM (low level virtual machine), and CLang (replaces the full GNU Compiler Collection and intended to work atop LLVM).
To make onboarding easier for new comers, swift can run in playground, or a web-based REPL like this.
REPL stands for “Read Eval Print Loop”, it’s a command-line environment with experience similar to interpreted languages.
Swift is a type-safe general-purpose & multi-paradigm language, the design goal of such languages is to allow programmers to use the most suitable programming style and associated language constructs for a given job, considering that no single paradigm solves all problems in the easiest or most efficient way, swift provides its own version of C/Obj-C types, along with powerful versions of the three primary collection types, Array, Set, and Dictionary, one other type it offers is tuple, so you can pass groups of vales, which is not available in Obj-C.
Language paradigms are a lot like musical genres, they’re messy things and we can argue about where to draw the lines, Sometimes swift is object-oriented, other times is functional. And it shines when generic.
The main Swift programming language consists of different projects, they are mentioned as below in swift.org site.
1- The Swift compiler command line tool
2- The standard library bundled as part of the language
3- Core libraries that provide higher-level functionality
4- The LLDB debugger which includes the Swift REPL
5- The Swift package manager for distributing and building Swift source code
6- Xcode playground support to enable playgrounds in Xcode.