https://www.dropbox.com/s/8x42mm9vmtoeovd/AnnotationMovingDemo.zip?dl=0

**Here the car image where I want to only rotate car icon.**

м приложении я получаю местоположение с сервера каждые 10 секунд, поэтому я хочу анимировать свою собственную аннотацию с анимацией из одной точки в другую.

Я хочу переместить аннотацию с MapKit в iOS Swift 3, как передать анимацию перемещения из одного места в другое. Я отправляю свой код класса viewController, пожалуйста, внимательно прочитайте и помогите мне выбраться из этого

Спасибо

Здесь я добавляю пользовательскую аннотацию

var point : MyCustomAnnotation?
   point = MyCustomAnnotation(coordinate:   CLLocationCoordinate2D(latitude: self.latitude , longitude: self.longitude ))
     point?.speed     = speed
     point?.dateTime  = time
     self.mapView.addAnnotation(point!)

После, чем

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {

    if annotation is MKUserLocation
    {
        return nil
    }
    UIView.animate(withDuration: 3)  {
        if(self.annotationView != nil )
        {


            self.annotationView?.removeFromSuperview()
        }else{

        }
        self.annotationView = self.mapView.dequeueReusableAnnotationView(withIdentifier: "Pin")
        if self.annotationView == nil{


            self.annotationView = AnnotationView(annotation: annotation, reuseIdentifier: "Pin")


            self.annotationView?.image = self.imagePin! 

            self.annotationView?.canShowCallout = false
        }else{
            self.annotationView?.annotation = annotation
        }

            let roatet =    CLLocation(latitud,e: self.latitude, longitude: self.longitude)
            .bearingToLocationDegrees(destinationLocation: CLLocation(latitude: self.rotLat, longitude: self.rotLng))


        self.rotLat = self.latitude
        self.rotLng = self.longitude

        self.annotationView?.image = self.imagePin?.imageRotatedByDegrees(oldImage: self.imagePin!, deg: CGFloat(roatet))


    return annotationView
}

И еще одна функция

  func mapView(_ mapView: MKMapView,
                 didSelect view: MKAnnotationView)
    {
        // 1
        if view.annotation is MKUserLocation
        {
            // Don't proceed with custom callout
            return
        }
        // 2
        let starbucksAnnotation = view.annotation as! StarbucksAnnotation
        let views = Bundle.main.loadNibNamed("CustomCalloutView", owner: nil, options: nil)
        let calloutView = views?[0] as! CustomCalloutView
        calloutView.lbAc.text = starbucksAnnotation.acV
        calloutView.lbFuel.text = starbucksAnnotation.fuelV + "%"
        calloutView.lbPower.text = starbucksAnnotation.powerV
        calloutView.lbIgnation.text = starbucksAnnotation.ignitionV
        calloutView.lbBattery.text = starbucksAnnotation.battry
        calloutView.lbDate.text = starbucksAnnotation.dateTime

        calloutView.center = CGPoint(x: view.bounds.size.width / 2, y: -calloutView.bounds.size.height*0.52)
        view.addSubview(calloutView)
      //  UIView.animate(withDuration: 5) {
           mapView.setCenter((view.annotation?.coordinate)!, animated: true)
       // }

    }
    func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
        if view.isKind(of: AnnotationView.self)
        {
            for subview in view.subviews
            {
                subview.removeFromSuperview()
            }
        }
    }

Ответы на вопрос(1)

Ваш ответ на вопрос