Latest 2.0.0
License MIT
Platforms ios 8.0


This is an implementation of the Hummingbird parser and serializer for Swift.


Hummingbird is a binary serialization format. See the spec
for details and format specification.

Version history

2.0.0 – A straightforward upgrade to Swift 4.0

1.0.0 – Initial release



CocoaPods is a dependency manager for Cocoa projects.
You can install it with the following command:

$ gem install cocoapods

To integrate Hummingbird into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '10.0'

target '<Your Target Name>' do
    pod 'Hummingbird', :git => ''

Then, run the following command:

$ pod install

Import Hummingbird at the top of any file that needs to call the framework

import Hummingbird


Here’s an online converter


Hummingbird can be used to serialize Swift classes or structs into HBON. This
works best if the class or struct extends HBEncodable and HBDecodable and
provide custom implementations for serializing or rehydrating the object.

struct Event: HBEncodable, HBDecodable {
    let timestamp: Double
    let level: Double

    init(timestamp: Double, level: Double) {
        self.timestamp = timestamp
        self.level = level

    init(decoder: HBDecoder) throws {
        timestamp = (try? decoder.decode("timestamp")) ?? -1
        level = (try? decoder.decode("level")) ?? 0.0

    func encode(_ encoder: HBEncoder) {
        encoder.encode(timestamp, forKey: "timestamp")
        encoder.encode(level, forKey: "level")

Then simple call the serialize and deserialize methods

do {
    let eventBytes = try HummingBird.serialize(event)    
} catch {
    // handle serialization error

do {
    response: Event = try HummingBird.deserialize(eventBytes)
} catch {
    // handle deserialization error

Non-object serialization and deserialization

This library provides simple methods to serialize and deserialize variables that
are not classes or structs.

do {
    let data: [UInt8] = try HummingBird.serializeAsRoot(stringVariable)            
} catch {
    // handle serialization error

do {
    let stringVar: string = try HummingBird.deserializeAsRoot(data)    
} catch {
    // handle deserialization error

(More comprehensive documentation TBD)


This project includes XCTestCases


Current maintainer


This project is licensed under the MIT License – see the LICENSE file for details

Latest podspec

    "name": "Hummingbird",
    "version": "2.0.0",
    "summary": "This is a Swift implementation of the parser and serializer for HummingBird Object Notation.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Echlo, Inc": "[email protected]"
    "source": {
        "git": "",
        "tag": "2.0.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "Hummingbird/*.swift",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    "pushed_with_swift_version": "3.1"

Pin It on Pinterest

Share This