Commit Graph

4 Commits

Author SHA1 Message Date
mustiikhalil 537212afee
[Swift] Adds a format file and reformats the swift project (#6250)
* Formats files & adds licence

* Revert arrays

* Keeps array indentation as is

* Adds licence to code formatter

* Updates code generators
2020-11-16 19:52:38 +03:00
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
mustiikhalil a4b2884e4e Added create function for swift (#5707)
Fixed the create functions and updated the test cases in swift

Removes unneeded code

Updated documentation
2020-01-13 12:34:06 -08:00
mustiikhalil 04d80f255d [Swift] Swift implementation 🎉🎉 (#5603)
* Implemented the swift version of Flatbuffers

Implemented serailzing, reading, and mutating data from object monster

Fixes mis-aligned pointer issue

Fixes issue when shared strings are removed from table

Adds swift enum, structs code gen

Fixed namespace issues + started implementing the table gen

Added Mutate function to the code generator

Generated linux test cases

Fixed an issue with bools, and structs readers in table writer

Swift docker image added

Updated the test cases, and removed a method parameters in swift

Fixed createVector api when called with scalars

Fixed issues with scalar arrays, and fixed the code gen namespaces, added sample_binary.swift

Cleaned up project

Added enum vectors, and their readers

Refactored code

Added swift into the support document

Added documentation in docs, and fixed a small issue with Data() not being returned correctly

Fixes Lowercase issue, and prevents generating lookups for deprecated keys

* Made all the required funcs to have const + removed unneeded code + fix lowercase func

* Removed transform from lowercased and moved it to function

* Fixes an issue with iOS allocation from read

* Refactored cpp code to be more readable

* casts position into int for position

* Fix enums issue, moves scalar writer code to use memcpy

* Removed c_str from struct function

* Fixed script to generate new objects when ran on travis ci: fix

* Handles deallocating space allocated for structs

* Updated the test cases to adhere to the fileprivate lookup, no mutation for unions, and updated the names of the vector functions
2020-01-09 12:12:10 -08:00