let task = urlSession.dataTaskWithRequest(urlRequest)
{ (data, response, error) -> Void in
guard error == nil else {
print("Error while fetching remote rooms: \(error)")
return
}
Is the below block can be alternative of the above one?
let task = urlSession.dataTaskWithRequest(urlRequest)
{ (data, response, error) -> Void in
if let myerror = error! {
print("Error while fetching remote rooms: \(myerror)")
return
}
No, this would be the correct "guard let" alternative.