Revise Codable?

Hi guys. Half a year ago I was told that we can't change Codable for Swift 5, but I've decided to show how much more flexible we could make it, and maybe.. we still can?

This changes allows us to write superfast raw coders on top of UnsafeRawBufferPointer or Substring without extra allocations and without classes at all. And we can use anything as CodingKey not just String / Int.

I don't think it'll pass so here the link: Revise Codable

I'll finish the implementation if anyone else is interested.


Thanks for this, @tonyfreeman.

I too wish that Encoder.container(keyedBy:), unkeyedContainer(), and singleValueContainer() could throw.

Look at this behemoth, almost 100 lines of workaround:

The good news is that adding the throws qualifier to those methods would not break any code :-)

Terms of Service

Privacy Policy

Cookie Policy