christophhagen / BinaryCodable

A binary encoder for Swift Codable types
MIT License
92 stars 7 forks source link

Supporting nil value #4

Closed lkzhao closed 1 year ago

lkzhao commented 2 years ago

I ran into this error when trying to encode an struct with an optional value. Does the library support nil value encoding?

Screen Shot 2022-08-28 at 8 58 07 AM
christophhagen commented 2 years ago

Optionals are supported.

Can you share your struct definition so that I can try to reproduce the error?

christophhagen commented 2 years ago

Are you still having issues with nil values? I couldn't reproduce the issue, and optionals are also covered by several test cases, which are all passing. Did you use custom decoding logic?

christophhagen commented 1 year ago

Appears to be the same issue as #6.

Use encodeIfPresent(_,forKey:) to prevent this issue