Advanced Codable — When the API wasn’t built for Swift
Advanced Codable — When the API wasn’t built for Swift
August 29, 2022 12:00 PM 12:45 PM Colorado Ballroom
Codable is an incredible part of Swift, and auto-generated conformances make many jobs trivial. But some server APIs are more complicated than the basic configuration options can handle, and you’ll need to write your own conformances. You might even have to write your own top-level encoder or decoder. In this session, I’ll cover hand-written solutions to common Codable problems such as dynamic keys, flattening nested and complex structures, and converting between ordered and unordered collections. I’ll provide tips for avoiding custom implementations when they aren’t needed, but for when that isn’t enough, I’ll dive deeper into the details of how Codable works, what it can and can’t do, and how practically build your own solutions from scratch when you must.