SwiftWebSocket
SwiftWebSocket copied to clipboard
Warnings about deprecated function
I'm getting the following warning about substring(to: )
being deprecated.
'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator.
It's inside the readResponse()
function
if let r = line.range(of: ":") {
key = trim(line.substring(to: r.lowerBound))
value = trim(line.substring(from: r.upperBound))
}
I think the fix according to https://stackoverflow.com/questions/45562662/how-can-i-use-string-slicing-subscripts-in-swift-4 is:
if let r = line.range(of: ":") {
key = trim(String(line[..<r.lowerBound]))
value = trim(String(line[r.upperBound...]))
}
Wish I read this before I just submitted the same issue. Should I keep it open because it has not been fixed ?