我有这段代码来获取从源点(userLocation)到注释(从用户中选择的引脚)的方向。`
func showRouteOnMap() {
let request = MKDirectionsRequest()
request.source = MKMapItem(placemark: MKPlacemark(coordinate: (userLocationForDirections?.coordinate)!, addressDictionary: nil))
if(annotationPin != nil){
request.destination = MKMapItem(placemark: MKPlacemark(coordinate: (coordinateAnnotationPin)!, addressDictionary: nil))
}
request.requestsAlternateRoutes = true
request.transportType = .walking
let directions = MKDirections(request: request)
directions.calculate(completionHandler: {(response, error) in
if error != nil {
print("Error getting directions")
} else {
self.showRoute(response!)
}
})
}
现在我需要获取方向路线的坐标(CLLocationCordinate2D)。我能怎么做?