For my app, I need to have a MapKit annotation have a circle around it with a desired radius, much like the margin of error circle that you can find in Find My Friends. I want to be able to call a function that will draw a circle around the point with a radius in meters (or feet, whichever works best). It would be nice to have the circle filled in instead of just the outline of a circle. Here is my code right now (without any attempts to create a circle):
import UIKit
import MapKit
class ViewController: UIViewController {
@IBOutlet weak var map: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
let span: MKCoordinateSpan = MKCoordinateSpanMake(0.3, 0.3)
let location: CLLocationCoordinate2D = CLLocationCoordinate2DMake(57.734274, -124.654364)
let region: MKCoordinateRegion = MKCoordinateRegionMake(location, span)
map.setRegion(region, animated: true)
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = "Random Area"
map.addAnnotation(annotation)
}
}
Thanks to anyone who can help.
You'd better check the official documentation and work with Custom Annotation View: