func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
let annotation = annotation as! CustomMapAnnotation
var annotationImage = mapView.dequeueReusableAnnotationImage(withIdentifier: annotation.id)
if annotationImage == nil {
var image = UIImage(named: "taxi")!
if let heading = annotation.heading {
image = image.imageRotatedByDegrees(degrees: heading)
}
image = image.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: 0, bottom: image.size.height/2, right: 0))
annotationImage = MGLAnnotationImage(image: image, reuseIdentifier: annotation.id)
}
return annotationImage
}
Я добавил MAPBOX в приложение для заказа такси и, добавляя заголовок к аннотации автомобиля, чтобы повернуть изображение в соответствии с указаниями дороги, но в нем есть какая-то ошибка, пожалуйста, помогите мне ее решить.