If you want to unconvert MKMapPoint in MKPolyline to CLLocationCoordinate2D, you may need a little more complex code.
Please add these lines in the code where overlays is valid:
overlays.forEach {overlay in
if let polyline = overlay as? MKPolyline {
var coords = Array(repeating: CLLocationCoordinate2D(), count: polyline.pointCount)
polyline.getCoordinates(&coords, range: NSRange(0..polyline.pointCount))
print(coords)
}
}
Have a good sleep.
Topic:
Programming Languages
SubTopic:
Swift
Tags: