Swiftpack.co - nnabeyang/swift-msgpack as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by nnabeyang.
nnabeyang/swift-msgpack 0.1.4
swift-msgpack is a library of MessagePack encoder & decoder for Swift based on Codable.
⭐️ 0
🕓 6 days ago
iOS macOS
.package(url: "https://github.com/nnabeyang/swift-msgpack.git", from: "0.1.4")

swift-msgpack

swift-msgpack is a library of MessagePack encoder & decoder for Swift based on Codable.

Usage

import SwiftMsgpack

let input: [Double: String] = [3.14159265359: "pi", 1.41421356237: "sqrt(2)"]

let data = try! MsgPackEncoder().encode(input)
let out = try! MsgPackDecoder().decode([Double: String].self, from: data)

print([UInt8](https://raw.github.com/nnabeyang/swift-msgpack/main/data))
print(out)
// [130, 203, 63, 246, 160, 158, 102, 127, 5, 90, 167, 115, 113, 114, 116, 40, 50, 41, 203, 64, 9, 33, 251, 84, 68, 46, 234, 162, 112, 105]
// [3.14159265359: "pi", 1.41421356237: "sqrt(2)"]

Installation

SwiftPM

Add the SwiftMsgpack as a dependency:

let package = Package(
    // name, platforms, products, etc.
    dependencies: [
        // other dependencies
        .package(url: "https://github.com/nnabeyang/swift-msgpack", from: "0.0.0"),
    ],
    targets: [
        .executableTarget(name: "<executable-target-name>", dependencies: [
            // other dependencies
                .product(name: "SwiftMsgpack", package: "swift-msgpack"),
        ]),
        // other targets
    ]
)

CocoaPods

Add the following to your Podfile:

pod 'SwiftMsgpack', :git => 'https://github.com/nnabeyang/swift-msgpack.git'

License

swift-msgpack is published under the MIT License, see LICENSE.

Author

Noriaki Watanabe@nnabeyang

GitHub

link
Stars: 0
Last commit: 5 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics