guillermomuntaner / Burritos

A collection of Swift Property Wrappers (formerly "Property Delegates")
MIT License
1.33k stars 43 forks source link

Could it be possible using a property wrapper with Decodable and optional value? #1

Closed CodeEagle closed 4 years ago

CodeEagle commented 5 years ago

Hi @guillermomuntaner , thanks your great repo, It's very helpful for swift developing.

It' seems that you have learn a lot about using property wrapper to provide convenient feature. Could you do me a favor, for helping me resolve the problem, just like what title says.

The situation is that, when using Decodable We need to know every property that is optional or not to define the model That's too hard to ensure you get what you want Sometime server just update, you fail to parse the data

But like other framework as HandyJSON, they provide default value for model We can safely define every property as non-optional with that

Is there a way to achieve this with Property Wrapper for Decodable? Thanks in advance

guillermomuntaner commented 5 years ago

Wrappers to interact with Codable are on my list, specially default values and custom field names, but I don’t thing much can be done at the moment. Once the evolution proposal review finishes I will implement whatever becomes possible.