From setting up your environment through variables, control flow, collections, optionals, functions and closures, structs and classes, protocols, error handling and async/await. Fifty lessons that take you to the point where you can read and write Swift without Xcode and assemble a task manager that saves to JSON. Every piece of code and result shown was produced by actually running Apple Swift 6.3.3.
about 3 hours in total (estimate)
The 50 lessons are grouped into seven chapters. Working through them in order is the best way,
but you are welcome to dip into whatever interests you.
Note: this cannot run inside the browser, so try it with your own swift command (Xcode Command Line Tools).
Take this chapter's review quiz ›
You get to grips with how Swift runs and get to the point of executing it yourself without Xcode. You cover variables, numbers, strings and standard input, and how to read compiler errors.
Take this chapter's review quiz ›
You cover conditionals and repetition: pattern matching with if and switch, for-in and ranges, while, break and continue. You finish by assembling a number-guessing game.
Take this chapter's review quiz ›
You gather values with Array, Dictionary, Set and tuples, and transform them with map, filter and reduce. Optionals and guard — the crux of Swift — are covered here too, and you finish by aggregating sales data.
Take this chapter's review quiz ›
You split work up by naming it, and learn to pass functions around as values. Argument labels, inout, closures, higher-order functions, generics and recursion, and on to refactoring.
Take this chapter's review quiz ›
You create your own data types. The difference between struct and class (value types versus reference types), mutating, initializers, inheritance, computed properties and observers.
Take this chapter's review quiz ›
You turn the states something can be in into a type using enums with associated values, and gather behavior with protocols and extensions. You finish by building an inventory system from structs and protocols.
Take this chapter's review quiz ›
throws, Result, file I/O, Codable, Swift Package Manager and async/await. You finish a task manager that saves to JSON, and see what to learn next.
Once you have finished all 50 lessons, look at Rust for Beginners, which leans toward safety in much the same way, or make types your weapon in TypeScript for Beginners. Membership unlocks every course.