google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library
https://flatbuffers.dev/
Apache License 2.0
23.37k stars 3.25k forks source link

[swift] Update tutorial for getRootAs -> getCheckedRoot #8409

Open peeeeter opened 1 month ago

peeeeter commented 1 month ago

WRT #7738, the tutorial still gives

// create a ByteBuffer(:) from an [UInt8] or Data()
let buf = // Get your data

// Get an accessor to the root object inside the buffer.
let monster = Monster.getRootAsMonster(bb: ByteBuffer(bytes: buf))
mustiikhalil commented 1 month ago

Hey,

Thanks for opening this issue! If you want to try to update the docs, feel free to open a PR for this.