Open jsbean opened 5 years ago
(This could also be made symmetrical as MusicXMLEncoder
.)
We could also tighten up the API a little, because we know we are always dealing with .utf8
:
extension MusicXMLDecoder {
func decode <T> (_ type: T.Type, from string: String) throws -> T where T: Decodable {
return try decode(type, string.data(using: utf8)!)
}
}
Now that we are disabling
.trimValueWhitespaces
from our decoder, it may make sense to create anXMLDecoder
subclassMusicXMLDecoder
.This way we can use
MusicXMLDecoder
when testing atomic units, so we know we are working with the same thing when decoding a wholeMusicXML
object.This will also allow us to wipe
XMLCoder
from testing, which has seemed slightly out of place.