Skip to content

Commit a1ea77f

Browse files
spevansparkera
authored andcommitted
swift4: String fixes (#1024)
- Failable String initialiser has been obsoleted in swift4. - Subscripts returning String were obsoleted in Swift 4, explicitly construct a String from subscripted result.
1 parent ed06e3a commit a1ea77f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Foundation/NSURLSession/http/HTTPMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private extension _HTTPURLProtocol._HTTPMessage._Header {
294294
if !line.isEmpty {
295295
if line.hasSPHTPrefix && line.count == 1 {
296296
// to handle empty headers i.e header without value
297-
value = String("")
297+
value = ""
298298
} else {
299299
guard let v = line.trimSPHTPrefix else { return nil }
300300
value = String(v)

TestFoundation/HTTPServer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class _TCPSocket {
9898
return stride(from: 0, to: str.characters.count, by: count).map { i -> String in
9999
let startIndex = str.index(str.startIndex, offsetBy: i)
100100
let endIndex = str.index(startIndex, offsetBy: count, limitedBy: str.endIndex) ?? str.endIndex
101-
return str[startIndex..<endIndex]
101+
return String(str[startIndex..<endIndex])
102102
}
103103
}
104104

0 commit comments

Comments
 (0)