1

I queried a set of coordinates for users around me from Parse(PFGeoPoint) and I have created annotations for said locations/coordinates. I will be updating the users location every 5 seconds and updating the location of the annotations, everything is working fine except for the fact that I'm having to remove and add annotations instead of them moving on their own similar to lyft, is there a way to do this in swift? please reply, thank you!!

Eric Prieto
  • 11
  • 1
  • 2

1 Answers1

1

Yes it is. As I can see from your tags, you are using MKPointAnnotation , so you an access its coordinate property and update it as you wish.

var coordinate: CLLocationCoordinate2D  

So all you have to do is set it up like this:

annotation.coordinate = newCoordinate

For more information, please look at Accessing the Annotation’s Location.

Fengson
  • 4,751
  • 8
  • 37
  • 62