jverkoey / BinaryCodable

Swift Codable-like interfaces for binary representations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to decode remainder of data in a container

interstateone opened this issue · comments

In the .binarycookies format, there's a constant "footer" value and then the rest of the data in the file is binary plist data. I think it would be best to use PropertyListSerialization to decode this, so I need a Data to pass to it. I don't think there's a way to do this in the current BinaryCodable API, is that right? Perhaps this could look like container.decode(length: nil), similar to how you can create a nested container without a maximum length, or container.decodeToEnd(). I don't have a strong opinion about the naming though.

The current implementation reads a byte at a time (in a way that probably copies them, too?) until it hits the end of the container.