[Swift] Inline arrays (#8755)

Implements InlineArrays which allow us to use Flatbuffers arrays within
Structs natively, and also implements FlatbufferVectors as a secondary API
when using mutable Structs

Fixes mutations within fixed sizes arrays

Adds tests and remove inout and mutating from generated objects in favor of borrowing

---------

Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
mustiikhalil
2025-11-15 00:33:16 +01:00
committed by GitHub
parent 7150dfb5c4
commit cbf0850828
18 changed files with 995 additions and 359 deletions

View File

@@ -148,7 +148,7 @@ final class FlatBuffersUnionTests: XCTestCase {
Movie.finish(&fb, end: end)
var buffer = fb.sizedBuffer
var movie: Movie = getRoot(byteBuffer: &buffer)
let movie: Movie = getRoot(byteBuffer: &buffer)
XCTAssertEqual(movie.charactersType.count, characterType.count)
XCTAssertEqual(movie.characters.count, characters.count)
@@ -213,7 +213,7 @@ final class FlatBuffersUnionTests: XCTestCase {
Movie.finish(&fb, end: end)
var buffer = fb.sizedBuffer
var movie: Movie = getRoot(byteBuffer: &buffer)
let movie: Movie = getRoot(byteBuffer: &buffer)
XCTAssertEqual(movie.mainCharacter(type: String.self), string)
XCTAssertEqual(
movie.characters(at: 0, type: BookReader_Mutable.self)?.booksRead,