Swift 5.1 support
Use stdlib Result instead of TAsyncResult
Fix: deprecations for `withUnsafeBytes`
Bump CI job Xcode version
Hash (into)
Co-authored-by: Sophie Lambrakis <SLambrakis@users.noreply.github.com>
Co-authored-by: Alexander Edge <alex@alexedge.co.uk>
diff --git a/lib/swift/Sources/TStreamTransport.swift b/lib/swift/Sources/TStreamTransport.swift
index d9c9574..5dd7dba 100644
--- a/lib/swift/Sources/TStreamTransport.swift
+++ b/lib/swift/Sources/TStreamTransport.swift
@@ -104,10 +104,7 @@
var bytesWritten = 0
while bytesWritten < data.count {
- bytesWritten = data.withUnsafeBytes {
- return output.write($0, maxLength: data.count)
- }
-
+ bytesWritten = data.withUnsafeBytes { output.write($0.bindMemory(to: UInt8.self).baseAddress!, maxLength: data.count) }
if bytesWritten == -1 {
throw TTransportError(error: .notOpen)
} else if bytesWritten == 0 {