目录
目录README.md

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.

关于
66.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号