flatbuffers/samples
Liu Liu e810635eaa
[Swift] FlatBuffers createMonster method doesn't treat struct properly (#5992)
* [Swift] FlatBuffers createMonster method doesn't treat struct properly

This PR fixed a issue where a struct is not treated properly when use
create inside.

A example would be the pos inside Monster. The createMonster method
takes an Offset for pos. However, FlatBuffersBuilder.add(struct:)
doesn't really take Offset argument. That means we don't really add a
struct at all for Monster.

It will show up as the pos never set.

This doesn't show up in FlatBuffersMonsterWriterTests.swift because it
implements its own createMonster method, which happens do the dance
properly (i.e. first call create(struct) and then immediately call
add:).

This PR modified the `add(pos:)` interface such that it takes the
UnsafeMutableRawPointer directly, calling `create(struct:)` under the hood.

I can add unit tests once the direction of this PR approved.

* Fix object api pack method codegen.

* Add unit tests that uses Monster.createMonster method to serialize.

* Updated sample_binary.swift
2020-06-28 12:36:55 +03:00
..
android
lua/MyGame/Sample
android_sample.sh
csharp_sample.sh
dart_sample.sh
go_sample.sh
java_sample.sh
javascript_sample.sh
kotlin_sample.sh
monster.bfbs
monster.fbs
monster_generated.h [C++] Got rid of memset's in constructors (#5938) 2020-06-01 17:58:52 -07:00
monster_generated.lobster
monster_generated.rs
monsterdata.json [docs] typo: updates monsterdata.json to be valid json (#5978) 2020-06-17 22:35:24 -07:00
php_sample.sh
python_sample.sh
sample_bfbs.cpp Ran src/clang-format-all.sh (#5617) 2019-11-11 09:29:37 -08:00
sample_binary.cpp Ran src/clang-format-all.sh (#5617) 2019-11-11 09:29:37 -08:00
sample_binary.go
sample_binary.lobster
sample_binary.lua
sample_binary.py
sample_binary.rs
sample_binary.swift [Swift] FlatBuffers createMonster method doesn't treat struct properly (#5992) 2020-06-28 12:36:55 +03:00
sample_flexbuffers.rs Rust Flexbuffers Documentation update (#5979) 2020-06-18 00:01:48 -07:00
sample_flexbuffers_serde.rs Rust Flexbuffers (#5669) 2020-05-07 14:11:26 -07:00
sample_text.cpp Ran src/clang-format-all.sh (#5617) 2019-11-11 09:29:37 -08:00
sample_text.lobster
SampleBinary.cs
SampleBinary.java
samplebinary.js
SampleBinary.kt
SampleBinary.php