swift_code_11.swift (371B)
1 import FlatBuffers 2 import Foundation 3 4 func run() { 5 // create a ByteBuffer(:) from an [UInt8] or Data() 6 let buf = [] // Get your data 7 var byteBuffer = ByteBuffer(bytes: buf) 8 // Get an accessor to the root object inside the buffer. 9 let monster: Monster = try! getCheckedRoot(byteBuffer: &byteBuffer) 10 // let monster: Monster = getRoot(byteBuffer: &byteBuffer) 11 }