blog.iankulin.com

Codable

Codable when the keys don't match

How to decode JSON in Swift when the key names don’t match your struct’s property names. I cover using a CodingKeys enum to map JSON keys to properties manually, and the simpler keyDecodingStrategy option for handling the common snake_case versus camelCase mismatch...

JSON encode/decode

Progress on my SwiftUI habit tracking app built for the 100 Days challenge, covering UI refinements like a fading checkmark and the shift from simulator testing to daily use on a real iPhone. Persistence uses Swift’s built-in JSON encoding with UserDefaults, which works well until the struct changes — I discuss the resulting decode failures and the lack of a simple way to decode missing properties using default values...