Caspert Caspert - 6 months ago 54
iOS Question

Calculate distance with MKGeodesicPolyline Swift 3 will end up in an error

I try to create a

between two coordinates:

let LAX = CLLocation(latitude: 33.9424955, longitude: -118.4080684)
let JFK = CLLocation(latitude: 40.6397511, longitude: -73.7789256)

var coordinates = [LAX.coordinate, JFK.coordinate]
let geodesicPolyline = MKGeodesicPolyline(coordinates: &coordinates, count: 2)


Unfortunately, it will trow me an error:

Ambiguous use of 'init(coordinates:count:)'

Already search for this problem, but can't find a working solution within Swift 3 / Xcode 8.

Anyone suggestions or the solution for this?


Just remove & and it will compile:

let geodesicPolyline = MKGeodesicPolyline(coordinates: coordinates, count: 2)