summaryrefslogtreecommitdiff
path: root/swift/Sources/FlatBuffers/FlatBufferBuilder.swift
diff options
context:
space:
mode:
Diffstat (limited to 'swift/Sources/FlatBuffers/FlatBufferBuilder.swift')
-rw-r--r--swift/Sources/FlatBuffers/FlatBufferBuilder.swift6
1 files changed, 6 insertions, 0 deletions
diff --git a/swift/Sources/FlatBuffers/FlatBufferBuilder.swift b/swift/Sources/FlatBuffers/FlatBufferBuilder.swift
index 9a4ed3d0..cf479fd6 100644
--- a/swift/Sources/FlatBuffers/FlatBufferBuilder.swift
+++ b/swift/Sources/FlatBuffers/FlatBufferBuilder.swift
@@ -50,6 +50,12 @@ public final class FlatBufferBuilder {
/// Returns the buffer
public var buffer: ByteBuffer { return _bb }
+ /// Returns A sized Buffer from the readable bytes
+ public var sizedBuffer: ByteBuffer {
+ assert(finished, "Data shouldn't be called before finish()")
+ return ByteBuffer(memory: _bb.memory.advanced(by: _bb.reader), count: _bb.reader)
+ }
+
// MARK: - Init
/// initialize the buffer with a size