mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-25 17:18:39 +00:00
[Swift] Rebuild the way swift handles structs from scratch (#6326)
* Rebuild the way swift handles structs from scratch * Updates docs, and sample binary * Replaces InMemory to Mutable * Migrates docs from inmemory * use inline for some functions * Renamed Mutable objects * Updates documentation
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
/// NativeStruct is a protocol that indicates if the struct is a native `swift` struct
|
||||
/// since now we will be serializing native structs into the buffer.
|
||||
public protocol NativeStruct {}
|
||||
|
||||
/// FlatbufferObject structures all the Flatbuffers objects
|
||||
public protocol FlatBufferObject {
|
||||
var __buffer: ByteBuffer! { get }
|
||||
@@ -28,15 +32,6 @@ public protocol ObjectAPI {
|
||||
mutating func unpack() -> T
|
||||
}
|
||||
|
||||
/// Readable is structures all the Flatbuffers structs
|
||||
///
|
||||
/// Readable is a procotol that each Flatbuffer struct should confirm to since
|
||||
/// FlatBufferBuilder would require a Type to both create(struct:) and createVector(structs:) functions
|
||||
public protocol Readable: FlatBufferObject {
|
||||
static var size: Int { get }
|
||||
static var alignment: Int { get }
|
||||
}
|
||||
|
||||
public protocol Enum {
|
||||
associatedtype T: Scalar
|
||||
static var byteSize: Int { get }
|
||||
|
||||
Reference in New Issue
Block a user