Leveraging Swift's Type System
summary
Argues Swift’s richer type system catches bugs earlier and documents intent, showing concrete tools: use a Result enum to make async success/failure mutually exclusive; prefer wrapper types with throwing initializers or the Validated library to guarantee valid emails; apply phantom types to tag UUID strings so user IDs can’t be passed where sheet IDs are expected; model JSON top-level as array|dictionary so 90% of runtime JSON errors become compile errors; replace subclass piles with protocol+generic downloaders that cache and decode.
AI-written summary · about
chapters (7)
- 0:00Intro
- 0:44History
- 5:59Asynchronous Error Handling
- 9:43Type Aliases
- 13:55Phantom Types
- 19:14Code Design
- 27:05Questions
related talks
40mLeveraging Swift’s Type System
52mType-Driven Design with Swift
20mHow Not to Write Swift
23mLessons in Swift Error Handling and Resilience
39mSwift and You
48mLearning From Our Elders: Applying functional insights without losing Swift
46mGeneric Swift: It Isn't Supposed to Hurt
50mWriting Swift code with great testability
