Serializer

master

Codable serialization to custom formats made easy
NobodyNada/Serializer

Serializer

Build Status

Swift 4's new Codable protocol makes it much simpler to serialize Swift objects. The built-in JSONEncoder and PlistEncoder encode and decode JSON and plist, but what about when you need to use other formats?

Writing a custom encoder is fairly complex, so Serializer takes care of that for you. Serializer converts your Swift objects into a simple enum, which you can easily traverse and write to a file format of your choice.

All you have to do is implement the Serializer protocol and create a method called serialize, which encodes a Serializable enum into your custom format. Decoding is similar -- add the Deserializer protocol, with a deserialize method which converts your custom format into a Serializable. Here's an example serializer and deserializer for the NBT file format.

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 17 2021 07:35:31 GMT-0500 (GMT-05:00)