0
我有這樣的代碼從一個源點(用戶位置)方向的註釋(引腳從用戶選用).`協調Xcode的路線在斯威夫特
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)。我能怎麼做?
謝謝特里斯坦 –