This might be user error, or might be related to #101 not really sure. I am trying to decode:
<?xml version="1.0" encoding="UTF-8"?>
<compendium>
<foobar>
<foo>Foo string value</foo>
<nested>
<name>Name</name>
<text>Bar string value</text>
</nested>
<nested>
<name>Name</name>
<text>Bar string value</text>
<text />
<text>Bar string value</text>
</nested>
</foobar>
</compendium>
My structs:
struct NestedObject : Codable {
var name : String?
var text : [String]?
}
struct Foobar : Codable {
var foo : String?
var nested : [NestedObject]?
}
struct Compendium: Codable {
var foobars: [Foobar]
enum CodingKeys: String, CodingKey {
case foobars = "foobar"
}
}
The empty text in the last nested object fails to decode. I think cause the String inside the array isn't optional, so when not there, the decoder freaks out? Not sure...any help would be appreciated!
This might be user error, or might be related to #101 not really sure. I am trying to decode:
My structs:
The empty text in the last nested object fails to decode. I think cause the String inside the array isn't optional, so when not there, the decoder freaks out? Not sure...any help would be appreciated!