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








