Hi,
I noticed the CodableWithConfiguration
protocol in the section of the talk about AttributedString
. I'm not really sure what purpose it serves and how it fits in with the original Codable
protocol.
As far as I can tell there aren't (as of beta 3) any ways to decode/encode objects conforming to this protocol with JSONDecoder
/PropertyListDecoder
/TopLevelDecoder
. I expected there to be something like JSONDecoder().decode(_:from:configuration:)
to match the existing JSONDecoder().decode(_:from:)
. It looks like only the keyed and un-keyed coding containers (but not single value containers) provide ways to decode/encode such objects.
I guess my questions are:
- What are the use cases for these new protocols?
- Is the configuration object designed to replace the
userInfo
dictionary onDecoder
/Encoder
? - If I currently pass required information to decoders/encoders via this
userInfo
dictionary, should I consider usingCodableWithConfiguration
to avoid typecasting fromAny
? - Why is support for decoding/encoding these objects so limited compared with the original
Codable
protocols?
Thanks!