MKMapViewDelegate
Optional methods that you use to receive map-related update messages.
Declaration
@MainActor protocol MKMapViewDelegate : NSObjectProtocolOverview
Because many map operations require the MKMapView class to load data asynchronously, the map view calls these methods to notify your app when specific operations complete. The map view also uses these methods to request annotation and overlay views, and to manage interactions with those views.
Before releasing an MKMapView object that you set a delegate for, remember to set that object’s delegate property to nil. MapKit calls all of your delegate methods on the app’s main thread.
Topics
Responding to map position changes
mapView(_:regionWillChangeAnimated:)mapViewDidChangeVisibleRegion(_:)mapView(_:regionDidChangeAnimated:)
Loading the map data
mapViewWillStartLoadingMap(_:)mapViewDidFinishLoadingMap(_:)mapViewDidFailLoadingMap(_:withError:)mapViewWillStartRenderingMap(_:)mapViewDidFinishRenderingMap(_:fullyRendered:)
Tracking the user’s location
mapViewWillStartLocatingUser(_:)mapViewDidStopLocatingUser(_:)mapView(_:didUpdate:)mapView(_:didFailToLocateUserWithError:)mapView(_:didChange:animated:)
Managing annotation views
mapView(_:viewFor:)mapView(_:didAdd:)mapView(_:annotationView:calloutAccessoryControlTapped:)mapView(_:clusterAnnotationForMemberAnnotations:)
Dragging an annotation view
Selecting annotations and annotations views
mapView(_:didSelect:)mapView(_:didDeselect:)mapView(_:didDeselect:)mapView(_:didSelect:)selectableMapFeatures