~/talk

Decoding Codable

Talkat 360iDev 2018 · 2018-08-26..08-29· [swift, web-platform]
name:Ellen Mey
links:none on file
slides:none on file

Codable turns verbose JSON parsing into a one‑liner by synthesizing initializers and CodingKeys so simple mappings require no manual work while enums, arrays and nested objects decode automatically. When JSON and property names diverge use custom CodingKeys or the decoder’s convertFromSnakeCase strategy. For awkward APIs manual encoding and decoding with keyed or nested containers lets code normalize dates, round numbers, or extract only the city field. Caveats: custom implementations must explicitly decode every property and missing required keys cause a decode failure.

AI-written summary · about

  1. 0:00Start
  2. 0:56What this talk covers
  3. 4:06Once upon a time...
  4. 5:53Wait we need to encode, too...
  5. 7:31Swift 4 X Encoding
  6. 7:52Magic
  7. 8:54Custom Types
  8. 10:11Custom Coding Keys
  9. 14:14Why would we want to?
  10. 16:02Nested Containers
  11. 18:27What if the root element is an array?
  12. 19:51keyDecodingStrategy
  13. 22:17Other things of note
  14. 24:30Thank You
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.