This post is the beginning of a new series on Swift
The Swift programming language was created by Apple in 2014, and it’s the official language to work with all the Apple Operating Systems lineup: iOS, iPadOS, watchOS, macOS, tvOS.
Swift is an open source, general purpose, compiled programming language.
It is a statically typed programming language.
Every value has a type assigned. The type of a value is always checked when used as argument or returned, at compile time. If there is a mismatch, the program will not compile.
The compiler of Swift is LLVM, and it is included within Xcode, the standard IDE used to work with Apple software development.
Swift is a modern programming language that was designed to “fit” in an ecosystem that was previously designed for a different programming language, called Objective-C.
Most of the software running on the iPhone and Mac today is based on Objective-C code, even for official Apple apps, although Swift usage is gaining traction year after year, and while Objective-C will be used for years to maintain and improve existing apps, new applications are likely going to be created with Swift.
Before Apple introduced Swift, Objective-C was heavily developed to introduce new capabilities and features, but in the recent years this effort has decreased a lot in favor of Swift development.
This does not mean Objective-C is dead or not worth learning: Objective-C is still an essential tool for any Apple developer.
That said, I am not going to cover Objective-C here, because we’re focusing on Swift.
The present and future of the Apple platform.
In just 6 years, Swift has gone through 5 major versions, and we’re now (at the time of writing) at version 5.3.
Swift is famously Apple’s products language, but it is not an Apple-only language. We can use it on several other platforms. It is open source, so porting the language to other platforms does not require any permission or licensing, and you can find Swift projects to create Web servers and APIs (https://github.com/vapor/vapor) as well as projects to interact with microcontrollers.
It is a general-purpose language, built with modern concepts, and it has a bright future.
Swift has some of the best documentation for a programming language I’ve ever seen. Yet, I want to write about it here, because I think that sometimes the docs are a little too complicated for beginners.
Plus, I learn by writing, and I decided to re-learn Swift, 5 years after I last touched a line of Swift. The language and the iOS ecosystem evolved quite a bit since then, and I feel like learning it from zero again.
This is the start of a new series of tutorials on Swift.
The goal of this series is to get you up and running with Swift, starting from zero.
If you have a Mac or an iPad I recommend you to download the Playgrounds application made by Apple from the App Store. This app lets you run snippets of Swift code without having to create a full app first. It’s a very handy way to test your code, not just when you start learning, but all the times you need to try some code. And it contains a series of awesome examples and tutorials to expand your Swift and iOS knowledge.
In this series I will soon talk about:
- Basic Operators
- Ternary conditionals
- Loop control transfer statements
- nil and Optionals
and that’s just the start!