Codable with SwiftData
Storing a JSON / Codable type with SwiftData is (kinda) working out of the box but gets clunky when you start modifying the data which leaves you with a couple database migration errors which I’ll cover here with a possible solution to circumvent it TLDR: Use Migrations or ValueTransformers 1. Context Recently I’ve stored a Codable struct in SwiftData working on a private project and went with the initial thought that SwiftData is able to handle it by itself which turned out to be true until I’ve made a couple of changes (introduced some new properties, changed types) and ran into migrations errors....