~/talk

Codeable in Swift 4

Talkat iOS Conf SG 2017 · 2017-10-19..10-20· [swift]
slides:none on file

Swift 4’s Codable auto generates encode and decode methods so JSON round trips become two lines using JSONEncoder/JSONDecoder. Examples show strings, dictionaries, structs and enums working out of the box, enums-as-nonstring-keys become arrays, and a UIColor is encoded as four RGBA numbers or as an object when using a keyed vs unkeyed container. Limitation: UIKit classes cannot gain Decodable in an extension so use a small wrapper type. CodingKeys maps JSON names to different property names.

AI-written summary · about

  1. 0:00Start
  2. 0:47Serialization
  3. 2:59Static Languages
  4. 3:21Introspection Reflection
  5. 5:01Json Parsing
  6. 5:55Swifty Jason
  7. 8:36Demo
  8. 8:53Encode a Property
  9. 9:13Json Encoder
  10. 13:23Json Serialization
  11. 16:22Add Relatives
  12. 19:24What Is an Array
  13. 23:13Decodable Protocol
  14. 23:51Encode a Ui Color
  15. 27:11Keyed Container
  16. 28:54Decode Jason into Ui Color
  17. 34:36Conclusion
~/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.