Srujan Srujan - 1 month ago 6x
Swift Question

Moving annotation from one coordinate point to another in Swift

This is a repost. I tried all I could do to get this thing done but wasn't successful.
I have two coordinate points and all I'm trying to do is moving an annotation from one point to another.

As an alternative solution, I found an Obj-C project in github which is very similar to this and I made a bridged connection between Swift and Obj-C to get this done. But for just moving annotation I had to use this whole project which I found is not a good solution.

Anyone who was successful in implementing such functionality (in swift)?


If you are using MKPointAnnotation as base, you can access the coordinate property, which is actually defined as var, e.g.

var coordinate: CLLocationCoordinate2D

Apple MKPointAnnotation Documentation. Therefore, when changing the coordinate, your annotation will move to another location.