Map Zoom

My map zooms in as many times as i click on the link, but as soon as I add an annotation the zoom is unpredictable. Any help appreciated. Once this code has a value to execute that's when the zoom messes up.

var myCount = myLocations.count
for myLocation in myLocations {
if (myLocation.date! >= WeeklySpan(increment: myValue) && myCount >= 1 ){
let annotations = MKPointAnnotation()
annotations.coordinate = CLLocationCoordinate2D(latitude: myLocation.latitude, longitude: myLocation.longitude)
annotations.title = myLocation.detail
mapView.addAnnotations([annotations])
myCount -= 1
// print(myValue)
// print(myCount)
// print(myLocation.date! as Any)
// print(WeeklySpan(increment: myValue))
} else { return mapView}

    }
    return mapView
}

I think I've seen your question both here and on the Apple Developer forums. If that's true, I gather you haven't gotten any help from there or here. This question is really off-topic for this forum since this is about MapKit, which is an Apple framework, and would even be a problem if your code was written in Objective-C. Since you seem to have not had much success on the forums, and you may have run into a limitation on MapKit, you might have to go to Apple Developer support to get an answer, but, filing an incident report or help ticket requires a paid Apple Developer account, if I am not mistaken.

1 Like