Episode #305

Codable and Polymorphism

19 minutes
Published on October 9, 2017

This video is only available to subscribers. Get access to this video and 584 others.

Codable is a great API, but sometimes real APIs can be tricky to model. In this episode we’ll examine a real use case of an API that returns a collection of elements, each of them similar but specified by a type. We’ll leverage Codable and inheritance to create a representation of this structure and show how you can peek into the container in order to determine what type to decode.

Episode Links

This episode uses Xcode 9.0, Swift 4.