The Type-Safe World of Codable
summary
Shows concrete patterns for using Codable beyond JSON: a DataConvertible protocol that encodes/initializes structs to Data, examples of storing structs in UserDefaults and Keychain, and two custom encoders/decoders including a DictionaryEncoder and a URL-query encoder that maps structs to query items and URLComponents. Demonstrates that Codable plus small protocol wrappers yields type-safe API parameter building and persistence, notes the custom encoder code is more verbose but available on the linked speakerdeck and that the approach works in apps.
AI-written summary Β· about








