mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 01:13:58 +00:00
[Swift] Implements FlatbuffersVector which confirms to RandomAccessCollection (#8752)
* Implements FlatbuffersVector in swift Implements FlatbuffersVector which confirms to RandomAccessCollection, this would give us semi-native sugary syntax to all the arrays in swift port. This work will also be the foundation of using arrays in swift * Fix failing tests for Swift
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
@_implementationOnly import FlatBuffers
|
||||
|
||||
internal struct Message: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||
internal struct Message: FlatBufferTable, FlatbuffersVectorInitializable, Verifiable, ObjectAPIPacker {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_25_9_23() }
|
||||
internal var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// swiftlint:disable all
|
||||
// swiftformat:disable all
|
||||
|
||||
public struct BytesCount: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
|
||||
public struct BytesCount: NativeStruct, FlatbuffersVectorInitializable, Verifiable, FlatbuffersInitializable, NativeObject {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_25_9_23() }
|
||||
|
||||
@@ -45,7 +45,7 @@ extension BytesCount: Encodable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct BytesCount_Mutable: FlatBufferObject {
|
||||
public struct BytesCount_Mutable: FlatBufferStruct, FlatbuffersVectorInitializable {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_25_9_23() }
|
||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
@@ -70,7 +70,7 @@ public struct BytesCount_Mutable: FlatBufferObject {
|
||||
}
|
||||
}
|
||||
|
||||
public struct InternalMessage: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||
public struct InternalMessage: FlatBufferTable, FlatbuffersVectorInitializable, Verifiable, ObjectAPIPacker {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_25_9_23() }
|
||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
@@ -153,7 +153,7 @@ public class InternalMessageT: NativeObject {
|
||||
public func serialize() -> ByteBuffer { return serialize(type: InternalMessage.self) }
|
||||
|
||||
}
|
||||
public struct Message: FlatBufferObject, Verifiable, ObjectAPIPacker {
|
||||
public struct Message: FlatBufferTable, FlatbuffersVectorInitializable, Verifiable, ObjectAPIPacker {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_25_9_23() }
|
||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
|
||||
@@ -24,12 +24,12 @@ let package = Package(
|
||||
.macOS(.v10_14),
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "../../..")
|
||||
.package(path: "../../.."),
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
name: "fuzzer",
|
||||
dependencies: [
|
||||
.product(name: "FlatBuffers", package: "flatbuffers")
|
||||
])
|
||||
.product(name: "FlatBuffers", package: "flatbuffers"),
|
||||
]),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user