Marker move According to Route MapBox

Multi tool use


Marker move According to Route MapBox
I have two annotations. There is an image on annotation. I want the image head toward route in MapBox.
Here is what I have tried:
func drawAnnoation (orgin :CLLocationCoordinate2D ,destination :CLLocationCoordinate2D){
if annotation == nil {
annotation = CameraAnnotation(coordinate: orgin, title: "SOURCE", subtitle: "D", image:"selfImage" )
let source = orgin
annotation.coordinate = source
annotation.title = "ddd"
map.setCenter(orgin, zoomLevel: 18, animated: false)
map.addAnnotation(annotation)
} else {
UIView.animate(withDuration: 1.5, animations: {
// Here Core Animation calls MapBox using an implicit animation.
self.annotation.coordinate = orgin
})
}
if annotations == nil {
let annotations = NoteAnnotation(coordinate: destination, title: "DESTINATION", subtitle: "E", image: "car")
let sources = destination
annotations.coordinate = sources
annotations.title = "d"
map.addAnnotation(annotations)
}
}
func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
guard annotation is CameraAnnotation || annotation is NoteAnnotation else {
return nil
}
if annotation is CameraAnnotation {
return dview
} else {
return sdview
}
}
Please help how to achieve this.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.