mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 05:12:17 +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:
@@ -56,9 +56,9 @@ public struct Table {
|
||||
|
||||
/// Reads from the buffer with respect to the position in the table.
|
||||
/// - Parameters:
|
||||
/// - type: Type of Scalar that needs to be read from the buffer
|
||||
/// - type: Type of Element that needs to be read from the buffer
|
||||
/// - o: Offset of the Element
|
||||
public func readBuffer<T: Scalar>(of type: T.Type, at o: Int32) -> T {
|
||||
public func readBuffer<T>(of type: T.Type, at o: Int32) -> T {
|
||||
directRead(of: T.self, offset: o + postion)
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ public struct Table {
|
||||
/// offset: __t.vector(at: offset) + index * 1)
|
||||
/// ```
|
||||
/// - Parameters:
|
||||
/// - type: Type of Scalar that needs to be read from the buffer
|
||||
/// - type: Type of Element that needs to be read from the buffer
|
||||
/// - o: Offset of the Element
|
||||
public func directRead<T: Scalar>(of type: T.Type, offset o: Int32) -> T {
|
||||
public func directRead<T>(of type: T.Type, offset o: Int32) -> T {
|
||||
let r = bb.read(def: T.self, position: Int(o))
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user