Learn Swift – all lessons
16 lessons from beginner to advanced, building on each other and with code examples.
Hello World, print & Strings
Your first Swift program, output, and string interpolation.
Variables, Constants & Types
let and var, type inference, and the most important basic types.
Conditions & Loops
if, switch with patterns, for-in, while, and ranges.
Functions & Argument Labels
Parameters, default values, return values, inout, and functions as values.
Arrays, Dictionaries & Sets
The three collection types, with value semantics and bounds checking.
Optionals
Swift's answer to null: a value is present or nil, enforced by the compiler.
Structs vs. Classes
Value types and reference types, methods, computed properties, and inheritance.
Enums with Associated Values
Enums that carry data: modeling states safely.
Protocols & Extensions
Describing behavior, default implementations, and extending existing types.
Closures & Higher-Order Functions
Anonymous functions, map/filter/reduce, and capturing values.
Error Handling
throws, try, do/catch, Result, and defer.
Swift Package Manager & Tests
Structuring projects, adding dependencies, and testing code.
ARC, weak & Retain Cycles
How Swift manages memory and how you avoid memory leaks.
Generics & Property Wrappers
Reusable code for many types, associated types, and property wrappers.
async/await, Tasks & Actors
The modern concurrency model: structured concurrency without callback chains.
SwiftUI: The Core Idea
Declarative interfaces: views as a function of state.