Skip to content

This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

License

Notifications You must be signed in to change notification settings

eduardbosch/FlatBuffersSwift

 
 

Repository files navigation

FlatBuffersSwift

Join the chat at https://gitter.im/mzaks/FlatBuffersSwift Build Status

Motivation

This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

One minute introduction

There are three simple steps for you to use FlatBuffersSwift

1. Write a schema file

table List {
  people : [Person];
}

table Person {
  firstName : string;
  lastName : string;
}

root_type List;

2. Generate Swift code

java -jar fbsCG.jar -fbs contacts.fbs -out contacts.swift -lang swift

3. Use the generated API

Create objects and encode them

let p1 = Person(firstName: "Maxim", lastName: "Zaks")
let p2 = Person(firstName: "Alex", lastName: "Zaks")
let list = List(people: [p1, p2])
let data = try?list.makeData()

Decode data very efficiently

let newList = List.makeList(data: data)
let name = newList?.people[0].firstName

Please check out Wiki for more information.

About

This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.2%
  • Other 0.8%