iOS Swift - Networking
This Swift code attempts to handle a network error but has a logic error:
URLSession.shared.dataTask(with: url) { data, response, error in
if error == nil {
print("No error")
} else {
print(error!.localizedDescription)
}
}.resume()
What is the likely cause of the logic error?