THRIFT-4547: Swift crosstests (#2670)
Co-authored-by: Jiayu Liu <Jimexist@users.noreply.github.com>
diff --git a/lib/swift/Sources/TSerializable.swift b/lib/swift/Sources/TSerializable.swift
index 1374700..ff976eb 100644
--- a/lib/swift/Sources/TSerializable.swift
+++ b/lib/swift/Sources/TSerializable.swift
@@ -61,11 +61,11 @@
public static var thriftType: TType { return .i8 }
public static func read(from proto: TProtocol) throws -> Int8 {
- return Int8(try proto.read() as UInt8)
+ return try proto.read() as Int8
}
public func write(to proto: TProtocol) throws {
- try proto.write(UInt8(self))
+ try proto.write(Int8(self))
}
}
@@ -129,3 +129,15 @@
try proto.write(self)
}
}
+
+extension UUID : TSerializable {
+ public static var thriftType: TType { .uuid }
+
+ public static func read(from proto: TProtocol) throws -> UUID {
+ return try proto.read()
+ }
+
+ public func write(to proto: TProtocol) throws {
+ try proto.write(self)
+ }
+}