So You Think You Know Swift?
summary
Examples reveal concrete surprises: arrays are structs backed by heap storage using copy‑on‑write and the runtime helper isKnownUniquelyReferenced, so mutations trigger copies; existentials use a fixed 24-byte inline buffer inside a 40‑byte existential container, so a struct growing from 24 to 25 bytes suddenly moves to the heap and causes a performance cliff; initializers are ordinary closures so passing an initializer works as a lightweight factory, while passing a method can silently create a retain cycle; JSONEncoder.sortedKeys behavior changes in iOS 18.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:27Advanced for Loops
- 2:29String Indexing Pitfalls
- 5:41Optional Syntax Nuances
- 7:23Optionals as Monads
- 9:07Enum Power Features
- 10:10Pattern Matching Deep Dive
- 13:43Exhaustive Switching
- 14:44Value vs Reference Types
- 16:50Copy-on-Write Explained
- 19:14Indirect Enums
- 19:37Protocols: Value vs Reference
- 22:05Existential Containers
- 24:12Any vs Some
- 25:13Nominal vs Structural Types
- 26:37Closures Everywhere
- 28:40Closure Retain Cycles
- 29:23Factory Pattern Simplified
- 31:32Swift 5.10 Features
- 33:17Unit Test Caution








