I have an application that allows users to drop a pin anywhere on their map (MapKit), and it currently identifies and displays their current location. I would like to set a constraint so that users are unable drop a pin any further than 10 miles from their current location. Is this doable? I am somewhat new to dev, so I am not sure where to begin doing this. Here's a bit of the code that deals with dropping pin:
@IBOutlet weak var mapView: MKMapView!
//addpin
@IBAction func addPin(sender: UILongPressGestureRecognizer) {
//locating where to drop the pin
let location = sender.locationInView(self.mapView)
let locCoord = self.mapView.convertPoint(location, toCoordinateFromView:
self.mapView)
let annotation = MKPointAnnotation()
annotation.coordinate = locCoord
annotation.title = "Test"
annotation.subtitle = "subtext"
//remove map point (use later)
self.mapView.removeAnnotations(mapView.annotations)
self.mapView.addAnnotation(annotation)
}