I have a new pitch available for adding additional
CodableWithConfiguration support to Foundation's top-level encoder/decoders. Please feel free to let me know if you have any comments or suggestions!
TopLevelDecoder protocols along with Foundation's conformers (
PropertyListEncoder , and
PropertyListDecoder ) offer an
decode function that accepts
some Codable instance. In previous releases, we also introduced the
CodableWithConfiguration protocol (which is now used by
Predicate in Foundation) to allow for encoding/decoding types with extra provided information. Currently,
CodableWithConfiguration types cannot be directly encoded/decoded by Foundation's coders. Instead, callers must wrap their
CodableWithConfiguration type within a separate
Codable type to provide to a coder like
JSONEncoder . While in many cases this may already be necessary, in some cases this is unnecessary extra work developers must do in order to get started with serializing these types. With new adoption of
Predicate this year, we'd like to improve this experience.
You can read the full pitch at the gist here and check out the implementation PR here.