feat[swift]: support swift protocol

This commit is contained in:
godotg committed 2024-07-28 17:24:19 +08:00
1 parent a4e7c0d5fa
commit 9b835ed23e
1 file changed
+8
@@ -64,6 +64,14 @@ class ByteBuffer {
return Array<Int8>(bytes)
}
func writeUBytes(_ bytes: [UInt8]) {
let length = bytes.count
ensureCapacity(length)
for ubyte in bytes {
writeUByte(ubyte)
}
}
func toBytes() -> [Int8] {
return Array<Int8>(buffer[0..<writeOffset])
}