Krzysztof Zabłocki 6/10/2020

Adding support for versioning and migration to your Codable models.

Read Original

This technical article addresses a limitation of Swift's Codable protocol: the lack of built-in data versioning and migration. It proposes a design using a custom Versionable protocol and VersionableDecoder to enable model evolution. The solution allows developers to define version enumerations and pure migration functions that modify JSON payloads, all while continuing to leverage Codable's automatic synthesis for most use cases.

Adding support for versioning and migration to your Codable models.

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser