Could this use the default value provided normally? var tags: [String] = []
BTW, do you plan to have an ability to opt-out some fields from being encodable/decodable?
Either on a per field manner or, on a per type manner.
I wonder if this could be more generic like this (pseudocode):
// generic
func encode(to encoder: inout JSONEncoder2) throws -> T {
try encoder.encodeStructFields() { fieldEncoder in
fieldEncoder.allFields { field in
try fieldEncoder.encode(field: field.title, value: field.value)
}
}
}
in which case having this per-type might be not required. Similarly for decoding.
I like the desire, but maybe we could invest into a more complete, robust and performant mirror machinery first... and reimplement new codable on top of that.