AI Workshop: learn to build apps with AI →
Swift Basics: Introduction to Swift

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


This tutorial 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. The type of a value is always checked when passed as an 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 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.

This is 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 product 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 that you download the Swift 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 whenever 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:

and that’s just the start!

Stay tuned.

Lessons in this unit:

0: Introduction
1: ▶︎ Introduction to Swift
2: Variables and Constants
3: Numbers
4: Booleans
5: Strings
6: Operators
7: Operator Precedence
8: Comments
9: Semicolons
10: How to join the Apple Developer Program
11: Installing iOS and Mac beta releases
12: Introduction to Swift and iOS development for Web developers
13: Some thoughts on SwiftUI
14: Why iOS