Why doesn't the swift compiler accept the following map closure
let coords = ["5.691663622856139,45.11744852318003","5.691341757774353,45.11710783320859"]
let nodes = coords.map({
let latlon = $0.componentsSeparatedByString(",")
let lon = Double(latlon[0])!
let lat = Double(latlon[1])!
return CLLocation(latitude: lat, longitude: lon)
})
cannot invoke map with an argument list of type (@noescape (String) throws -> _)
and yet
let nodes:[CLLocation] = coords.map({
let latlon = $0.componentsSeparatedByString(",")
let lon = Double(latlon[0])!
let lat = Double(latlon[1])!
return CLLocation(latitude: lat, longitude: lon)
})
works well.