THRIFT-4902: Swift 4 and 5 compatibility (#1827)
diff --git a/lib/swift/Sources/TProtocol.swift b/lib/swift/Sources/TProtocol.swift
index b111e71..b4e5dbe 100644
--- a/lib/swift/Sources/TProtocol.swift
+++ b/lib/swift/Sources/TProtocol.swift
@@ -18,7 +18,6 @@
*/
import Foundation
-//
public enum TMessageType: Int32 {
case call = 1
@@ -99,19 +98,19 @@
}
public extension TProtocol {
- public func writeFieldValue(_ value: TSerializable, name: String, type: TType, id: Int32) throws {
+ func writeFieldValue(_ value: TSerializable, name: String, type: TType, id: Int32) throws {
try writeFieldBegin(name: name, type: type, fieldID: id)
try value.write(to: self)
try writeFieldEnd()
}
- public func validateValue(_ value: Any?, named name: String) throws {
+ func validateValue(_ value: Any?, named name: String) throws {
if value == nil {
throw TProtocolError(error: .unknown, message: "Missing required value for field: \(name)")
}
}
- public func readResultMessageBegin() throws {
+ func readResultMessageBegin() throws {
let (_, type, _) = try readMessageBegin();
if type == .exception {
let x = try readException()
@@ -120,17 +119,17 @@
return
}
- public func readException() throws -> TApplicationError {
+ func readException() throws -> TApplicationError {
return try TApplicationError.read(from: self)
}
- public func writeException(messageName name: String, sequenceID: Int32, ex: TApplicationError) throws {
+ func writeException(messageName name: String, sequenceID: Int32, ex: TApplicationError) throws {
try writeMessageBegin(name: name, type: .exception, sequenceID: sequenceID)
try ex.write(to: self)
try writeMessageEnd()
}
- public func skip(type: TType) throws {
+ func skip(type: TType) throws {
switch type {
case .bool: _ = try read() as Bool
case .i8: _ = try read() as UInt8