Closed pteasima closed 6 years ago
The pattern for type-erased containers, such as AnyHashable
, is for the designated initializer to take a type conforming to the relevant protocol. However, in the case of AnyCodable
, I was unable to make this work. I left the initializer here to take a generic parameter as a way to acknowledge this pattern; it could just as well take Any?
instead.
If anyone can suggest a way to do this correctly, please submit a PR!
Hi, love the work. I wonder why its not
init<T: Codable>(_ value: T?)
. Could this catch more errors at compile time?