Skip to content

Thanks for NullCodable, and some notes #1

@crontab

Description

@crontab

First of all, thanks for the snippet! It saved me a lot of time and eventually helped understand how the Encoder/Decoder interfaces work a bit better.

I'm writing an encoder/decoder pair for MySQL-NIO as a part of a new server framework - will open the repo once it's ready. A few things I noticed:

  • NullCodable is good for any type of encoders/decoders, not just JSON ones, so you can mention this in your README. For example, there's Apple's PropertyListDecoder, and any custom ones coming from other developers.
  • The extension KeyedDecodingContainer part is probably not needed. At least in my case everything works with or without that part. It might be, however, that this extension shortens the decoding path, i.e. NullCodable(from:) won't be called in certain situations (but not others). But I'm not entirely sure about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions