JetForMe
(Rick M)
1
When I write a Codable structure with mismatched coding keys, the Swift compiler will tell me that it doesn't conform to Decodable. Is this something Swift can do for any similar data structure, or is it something baked into the compiler just for Codable?
struct MyType : Codable {
var foo: String
var bar: String
enum CodingKeys : String, CodingKey {
case foo = "a_foo"
}
}
vanvoorden
(Rick van Voorden)
2
It looks like there is a function for this validation… but I'm not sure how practical it would be for any arbitrary engineer to roll their own validation without a tool like swift-syntax or something else to read the AST.
1 Like
JetForMe
(Rick M)
3
I figured it had to be in the compiler. Thanks.