Skip to content
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] Adds a serialize helper function to native table #6059

Merged
merged 1 commit into from
Aug 4, 2020

Conversation

mustiikhalil
Copy link
Collaborator

@mustiikhalil mustiikhalil commented Aug 3, 2020

The following adds the function serialize to the object-api classes:

changes:
1- adds func serialize() -> ByteBuffer { return serialize(type: flatbuffers_object.self) } into the generated code

2- creates the helper methods:

public func serialize<T: ObjectAPI>(type: T.Type) -> ByteBuffer where T.T == Self
/// Allows devs to pass in their own builders, in case they have them in a singletons, instead of reallocating the space each time
public func serialize<T: ObjectAPI>(builder: inout FlatBufferBuilder, type: T.Type) -> ByteBuffer where T.T == Self

where the second serialize function gives the developer more control over the builder that's being passed to it
@jackflips

Closes #6058

@mustiikhalil mustiikhalil force-pushed the adds-serialize-function branch from bb6af16 to d205bca Compare August 4, 2020 03:02
@mustiikhalil mustiikhalil merged commit 63cc0ee into google:master Aug 4, 2020
@mustiikhalil mustiikhalil deleted the adds-serialize-function branch August 4, 2020 10:53
mustiikhalil pushed a commit to mustiikhalil/flatbuffers that referenced this pull request Aug 4, 2020
* Adds a serialize helper function to native table
* Updated version
ivannp pushed a commit to ivannp/flatbuffers that referenced this pull request Oct 2, 2020
* Adds a serialize helper function to native table
* Updated version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Swift] Reference in Object API to underlying type
1 participant