Winter scenery in Kyoto, Japan

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....

November 10, 2023 · 4 min · Timotheus Laubengaier - A blog about iOS development
Winter scenery in Kyoto, Japan

Swift Bytes / February

Lately, I’ve started creating a curated list of interesting Swift articles and learnings to keep them in lazy brain memory aka Notion and being able to review it at a later point. I think this the best picks can be helpful so I’ll just share them here. I’ll go with Swift Bytes for this series. TLDR: For this month it’s mainly syntax related things. 1. Better map’s map(\.{var}), filter(\.{var}), compactMap(\.{var})...

March 3, 2023 · 3 min · Timotheus Laubengaier - A blog about iOS development