mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
Finished documenting flatbuffersbuilder Replaces swift 5.5 with 5.2 packages Starts building the tutorial for xcode 13 Finishes building the tutorial for xcode 13 Removes docc files from old swift versions Updates swift style guide
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
@Tutorial(time: 2) {
|
|
@Intro(title: "Reading ByteBuffers") {
|
|
After getting our ByteBuffer created, we can now read it.
|
|
}
|
|
|
|
@Section(title: "Reading your first buffer") {
|
|
@ContentAndMedia {}
|
|
@Steps {
|
|
@Step {
|
|
After fetching the data from disk or network you need to access that data, and that can be done.
|
|
By simply calling `getCheckedRoot`, which checks if the data is valid before enabling you to read from a corrupt buffer.
|
|
however, if you are sure that the data is 100% correct you can simply call `getRoot`
|
|
@Code(name: "ViewController.swift", file: "swift_code_11.swift")
|
|
}
|
|
@Step {
|
|
Now since we have a Monster object, all the fields can be accessed by simply fetching the data. Note, Deprecated fields will not
|
|
show up
|
|
@Code(name: "ViewController.swift", file: "swift_code_12.swift")
|
|
}
|
|
@Step {
|
|
And you can access union types as easy as this
|
|
@Code(name: "ViewController.swift", file: "swift_code_13.swift")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|