yapstudios / YapDatabase

YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers.
Other
3.35k stars 365 forks source link

[Swift] Provide an option to choose the preferred Encoder/Decoder #531

Closed mickeyl closed 3 years ago

mickeyl commented 4 years ago

YapDatabase.swift's codableSerializer and codableDeserializer explicitly mention the PropertyListEncoder / PropertyListDecoder which not only creates relatively unefficient byte streams, but is also not available on platforms other than Apple's.

It would be nice to have the option to provide the actual encoder/decoder classes here, so that we could, e.g., use a more efficient MessagePackEncoder.

gcox commented 3 years ago

@mickeyl If you want to use a different encoder/decoder, you can just call registerSerializer/registerDeserializer and their metadata counterparts directly rather than using the helpers.

mickeyl commented 3 years ago

@gcox Thanks, yes, I can do that – I just felt it would be more nice to have it in the official API.