Introduction to Swift
Swift is a general purpose, multi-paradigm, compiled programming language for developing iOS and OS X tvOS, and watchOS applications. Apple Inc develops it. It is a powerful and intuitive language that is easy to learn. Swift code is safe, precise, and runs very fast.
Swift 5 is the latest version of Swift which inbuilt the features of Swift 4 and enhanced the language's robustness and stability.
Prior to Swift
Prior to Swift coming into the picture, Objective-C was used to develop mac and ios apps.
Objective-C is the primary programming language you use when writing software for OS X and iOS. Itβs a superset of the C programming language and provides object-oriented capabilities and dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. It also adds language-level support for object graph management and objects literals while providing dynamic typing and binding, deferring many responsibilities until runtime.
History of Swift
Swift was introduced in 2014 at Apple's Worldwide Developers Conference.
The development of Swift was started in 2010 by Chris Lattner with other programmers i.e. Doug Gregor, John McCall, Ted Kremenek, and Joe Groff at Apple.
Swift was inspired by Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and many other programming languages.
Swift's first version was 1.0 which underwent a major upgrade to Swift 2 at WWDC 2015.
Its upgraded version 2.2 was made open-source software under the Apache License 2.0 on December 3, 2015, for Apple's platforms and Linux.
Versions | Release Date |
Swift 1.0 | September 9, 2014 |
Swift 1.1 | October 22, 2014 |
Swift 1.2 | April 8, 2015 |
Swift 2.0 | September 21, 2015 |
Swift 3.0 | September 13, 2016 |
Swift 4.0 | September 19, 2017 |
Swift 4.1 | March 29, 2018 |
Swift 4.2 | September 17, 2018 |
Swift 5.0 | March 25, 2019 |
Swift 5.1 | September 10, 2019 |
Swift 5.2 | March 24, 2020 |
Swift 5.3 | September 16, 2020 |
Swift 5.4 | April 26, 2021 |
Swift 5.5 | September 20, 2021 |
Swift 5.6 | March 14, 2022 |
Swift 5.6.3 | September 2, 2022 (latestπ) |
Features of Swift
- Swift follows the Objective-C like syntax.
- Swift is an Open Source Programming Language.
- Swift is one of the fastest general-purpose languages.
- Swift provides an easy way to write iOS and OS X apps.
- Swift provides an enhanced set of modern programming features.
- Swift has more performance features.
- Easier memory allocation and deallocation.
- Swift has access control like public, private, open, internal, and fileprivate.
Pros of Swift
- Rapid development process.
- Easier to scale the product and the team.
- Improved safety and performance.
- Interoperability with Objective-C.
- Full stack potential and cross-device support.
- Vibrant open source community.
Cons of Swift
- Swift is considered a βmoving targetβ.
- Limited talent pool.
- Lack of support for earlier iOS versions(Prior to ios7).
Pre requisite to learn Swift
- Any Apple Computer
- XCode (IDE to write code)
How is Swift programming language different from Objective C?
- Safer type system, (e.g. no nil outside of Optional)
- Mutability is discouraged, (but still possible if required)
- Type inference
- No headers
- Better support for concurrency
- Easier to learn & easier to maintain
- Much better support for the functional programming paradigm
- More powerful enum types
- Reference compiler is open-source and development is done in the open
- Playgrounds, (code is executed as you type is)
- Linux support
Important Websites:
Official Website for Documentation and Resources: https://www.swift.org
Swift Source Code: https://www.swift.org/source-code
Did you find this article valuable?
Support Prahlad Inala by becoming a sponsor. Any amount is appreciated!