Intermediate¶
For you if you know the syntax but value vs reference types, protocols, generics, closures and memory management still feel shaky. By the end you'll design your own types, write generic and protocol-based code, manage memory correctly, parse JSON, organise code into packages, test it, and have built a real tool.
Lessons¶
| # | Lesson | You'll learn |
|---|---|---|
| 1 | Structs & classes | value vs reference semantics, initializers, mutating, when to use which |
| 2 | Properties & methods | computed, lazy and observed properties, static, access control, subscripts |
| 3 | Enums & pattern matching | raw & associated values, indirect, if case, exhaustive switch |
| 4 | Protocols & extensions | requirements, default implementations, constrained extensions, standard protocols |
| 5 | Generics | generic functions & types, constraints, associated types, some |
| 6 | Closures & higher-order functions | closure syntax, capturing, @escaping, map/filter/reduce, @autoclosure |
| 7 | Memory management & ARC | reference counting, retain cycles, weak/unowned, capture lists |
| 8 | Error handling in depth | designing error types, rethrows, Result, typed throws, precondition |
| 9 | Codable & JSON | encoding/decoding, CodingKeys, strategies, custom coding |
| 10 | Swift Package Manager | targets, products, dependencies, library + executable split, ArgumentParser |
| 11 | Testing | Swift Testing & XCTest, parameterized tests, fakes, temp directories |
| 12 | Capstone: link checker | a tested, modular Markdown link checker |
How to work through it¶
- Build each example in a scratch package, and keep your own notes on why each design choice was made.
- Exercises here are bigger. It's fine to spend a whole sitting on one.
- Write a test for every non-trivial function from lesson 11 onward.
When you're done¶
You should be able to explain every line of the capstone, add a feature to it, and write a test for it. Then go to Advanced.