Advanced Codable — When the API wasn’t built for Swift
summary
Shows when auto Codable fails and gives concrete fixes: hand-write conformance, a lightweight any CodingKey wrapper and container subscripts, or generate code with Sorcery. Demonstrates a small JSON value type, a custom parser to preserve ordering/duplicates, and about 100 lines of helpers that drill into the Pokedex API payloads. Provides patterns for error handling (fail fast vs compactMap), handling dynamic keys, nested super-encoding, and an experimental async JSON decoder — all working code, not just abstract advice.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:09Advanced Codable matters
- 8:16Coding keys beyond enums
- 13:57Default values and errors
- 18:16Arbitrary JSON keys
- 21:53Mismatched JSON structures
- 24:40Stateful decoding
- 25:22Encoding classes
- 31:38Extending Codable
- 32:00Raw JSON parsing
- 36:39Type-safe JSON values
- 41:32JSON parsing internals
- 43:38Custom JSONDecoder
- 45:45Future directions








