Swift 4 Codable
summary
Swift 4 Codable maps JSON to Swift structs with auto-synthesized CodingKeys and generated init(from:) / encode(to:), letting JSONDecoder/JSONEncoder parse a multiline JSON string into a struct in one line. It supports primitives, Optionals, Array/Dictionary and CoreGraphics types, and uses Keyed/Unkeyed/SingleValue containers under the hood. Custom keys (snake_case → camelCase), value validation (reject ints outside 0–200), and learning that synthesis is done by compiler helper functions are demonstrated; enum-based container ideas are blocked by current generics.
AI-written summary · about
chapters (9)
- 0:00Start
- 2:24Codable Example
- 2:48Conform to protocol Codable
- 3:08Use decoder & encoder
- 4:50Auto-synthesis example
- 12:40Overview of Codable (1)
- 16:101. Requires type variable as argument
- 17:122. Can container be enum?
- 19:11Recap








