-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[swift] Update tutorial for getRootAs -> getCheckedRoot #8409
Comments
Hey, Thanks for opening this issue! If you want to try to update the docs, feel free to open a PR for this. |
Sorry to bother you on an unrelated bug, but flatc generates getRootAs* methods in Swift for you? It doesn't for me (C# and Java are generated). Is there something I am missing or not doing? I am doing |
@oxygen so the generated getRootAs* methods are deprecated within swift. the new way is described below. Or you can follow the DocC documentation within xcode
flatbuffers/swift/Sources/FlatBuffers/Documentation.docc/Resources/code/swift/swift_code_12.swift Line 9 in 99fda81
|
@mustiikhalil Thank you, this was not intuitive and I was about to compute the offset which would have been ugly. Hopefully the getRootAs functions will be undeprecated and modified into throwing from this checked thing (perhaps on the next major version). This would save you from updating the tutorial, so we’re now relevant to this thread :) |
Maybe we can add a helper function through the generator, but it will run through this function. |
@mustiikhalil I didn't look yet but I supose getCheckedRoot will throw instead of crashing the program with a fatal error on malformed data. So yeah |
WRT #7738, the tutorial still gives
The text was updated successfully, but these errors were encountered: