Beyond JSON with FlatBuffers
-
Upload
maxim-zaks -
Category
Software
-
view
4.763 -
download
2
Transcript of Beyond JSON with FlatBuffers
![Page 1: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/1.jpg)
Beyond JSON@iceX33Game developer at Wooga
![Page 2: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/2.jpg)
What was the most discussed topic of Swift community?
![Page 3: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/3.jpg)
JSON parsing!
![Page 4: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/4.jpg)
What if I tell you there is another way?
![Page 5: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/5.jpg)
Meet FlatBuffersIt was originally created at Google for game development and other performance-critical applications.
![Page 6: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/6.jpg)
FlatBuffersis an efficient cross platform serialization library for C++, Java, C#, Go, Python and JavaScript (C, PHP & Ruby in progress).
![Page 7: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/7.jpg)
FlatBuffersSwift
![Page 8: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/8.jpg)
What is so good about FlatBuffers?
![Page 9: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/9.jpg)
There is no parsing involved!!!Reading data can be done lazy (almost zero cost)
![Page 10: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/10.jpg)
It's backwards and forwards compatiblenew code can read old data
&old code can read new data
![Page 11: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/11.jpg)
It's not human readableAnd it's a good thing! (Easy to encrypt and to compress)
![Page 12: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/12.jpg)
FlatBuffers Swift has a really nice API:
let data = NSData(contentsOfFile: "contactList.bin")!let byteArray = UnsafePointer<UInt8>(data.bytes)
let contactList = ContactList.fromByteArray(byteArray)
if let birthday = contactList.entries[5]?.birthday { birthday.day = 12 birthday.month = 6}
let newData = config.toByteArray
![Page 13: Beyond JSON with FlatBuffers](https://reader034.fdocuments.in/reader034/viewer/2022042723/587f28b71a28ab121d8b48a1/html5/thumbnails/13.jpg)
If you are interested or want to get involved?https://github.com/mzaks/FlatBuffersSwift