Wusstest du, dass die richtige Verwendung des Codable-Protokolls dir helfen kann, effizient mit JSON-APIs zu arbeiten? Sei dabei, wenn @5sw in seinem Vortrag wertvolle Tipps und Tricks teilt!
Hol Dir jetzt Dein Ticket: https://macoun.de/anmelden
#codable #appentwicklung #jsonapis #effizienz #macounffm
Is there really no way to specify default values for #swift #Codable #Decodable keys? Like, if a JSON key is missing, provide a default value for a struct’s property, without having to write a custom `init(from:)` initializer?
That makes it hard to dot-version rev a schema by adding keys, but continue to maintain backward-compatibility with older saved data…
Is this weird? Or normal?
I needed a type which is codable so I can archive/transmit it in various ways, which boxes a result with noncodable types.
More work on my app.
Been trying to set it up so #CoreData objects can be created and updated from the objects sent from the API using the #Codable protocol.
It has had its headaches but I got it mostly set up, even to the point of updating existing objects in the data store.
My issue comes when I hit a collection of objects. I’m not sure how to handle inside of the init(from: Decoder) when some or all of those objects are already in my store