6 days ago
btw, the following block doesn't work
guard let httpResponse = response as? HTTPURLResponse,
httpResponse.statusCode == 200 else {
throw NetworkError.badStatus(httpResponse.statusCode)
}
If the first guard condition fails there's no httpResponse to extract a status code from/