A MessagePack encoder and decoder for Codable types.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MessagePack.playground
MessagePack.xcworkspace
Shared Sources
Sources/MessagePack
Tests
.gitignore
.travis.yml
LICENSE.md
Package.swift
README.md

README.md

MessagePack

A MessagePack encoder and decoder for Codable types.

This functionality is discussed in Chapter 7 of Flight School Guide to Swift Codable.

MessagePackEncoder

let encoder = MessagePackEncoder()
let value = try! encoder.encode(["a": 1, "b": 2, "c": 3])
// [0x83, 0xA1, 0x62, 0x02, 0xA1, 0x61, 0x01, 0xA1, 0x63, 0x03]

MessagePackDecoder

let decoder = MessagePackDecoder()
let data = Data(bytes: [0xCB, 0x40, 0x09, 0x21, 0xF9, 0xF0, 0x1B, 0x86, 0x6E])
let value = try! decoder.decode(Double.self, from: data)
// 3.14159

License

MIT

Contact

Mattt (@mattt)