@@ -23,7 +23,13 @@ extension FileHandle {
2323
2424 /// A method to read data from a file handle that is safe to call in Swift from any operation system version.
2525 func readDataUp( toLength length: Int ) throws -> Data {
26- if #available( iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , macOS 10 . 15 , * ) {
26+ if #available( iOS 13 . 4 , tvOS 13 . 4 , watchOS 6 . 2 , macOS 10 . 15 . 4 , * ) {
27+ if let data = try read ( upToCount: length) {
28+ return data
29+ } else {
30+ return Data ( )
31+ }
32+ } else if #available( iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 2 , macOS 10 . 15 , * ) {
2733 return try __readDataUp ( toLength: length)
2834 } else {
2935 return try ObjectiveC . unsafe { readData ( ofLength: length) }
@@ -32,7 +38,9 @@ extension FileHandle {
3238
3339 /// A method to write data to a file handle that is safe to call in Swift from any operation system version.
3440 func write( data: Data ) throws {
35- if #available( iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , macOS 10 . 15 , * ) {
41+ if #available( iOS 13 . 4 , tvOS 13 . 4 , watchOS 6 . 2 , macOS 10 . 15 . 4 , * ) {
42+ return try write ( contentsOf: data)
43+ } else if #available( iOS 13 . 0 , tvOS 13 . 0 , watchOS 6 . 0 , macOS 10 . 15 , * ) {
3644 return try __write ( data, error: ( ) )
3745 } else {
3846 return try ObjectiveC . unsafe { write ( data) }
0 commit comments