I am trying to implement an MKCircle that either increases or decreases in radius as a slider is changed. The issue I have is that when the circle is redrawn it isn't smooth at all. I have read a few other posts and they seem to indicate that you have to create a subclass of MKCircle and somehow do it in that but whenever I look at example code I have a tough time following since its usually not in Swift 3. Could someone show me how to do this? Here is my code for when the slider is changed:
func sliderValueChanged(_ sender:UISlider!) {
if (!map.selectedAnnotations.isEmpty) {
for overlay in map.overlays {
var temp : MKAnnotation = (map.selectedAnnotations.first)!
if (overlay.coordinate.latitude == temp.coordinate.latitude && overlay.coordinate.longitude == temp.coordinate.longitude) {
let newCirc : MKCircle = MKCircle(center: temp.coordinate, radius: CLLocationDistance(Float(sender.value*1000)))
let region: MKCoordinateRegion = MKCoordinateRegionForMapRect(newCirc.boundingMapRect)
let r: MKCoordinateRegion = map.region
if (region.span.latitudeDelta > r.span.latitudeDelta || region.span.longitudeDelta > r.span.longitudeDelta){
map.setRegion(region, animated: true)
}
map.add(MKCircle(center: temp.coordinate, radius: CLLocationDistance(Float(sender.value*1000))))
map.remove(overlay)
break
}
}
}
}