I have written about MapKit a few times before such as a tutorial about adding a Map to your SwiftUI app and the MKPointAnnotation tutorial from back in 2013, which uses Swift and UIKit.
In this tutorial we’ll look at using the Annotation and Marker structures that provide the means to getting annotations on your map to mark locations.
SwiftUI makes it easy to display locations on a map. For apps that target iOS 16 or later, Annotation and Marker are the way to go. For those that are targetting lower versions of iOS the equivelant to Marker is MapMarker and the equivalent of Annotation is MapAnnotation. Today we’ll look at Marker and Annotation.


The MKUserLocation is a class that is used to create an annotation for the users current location. This particular class is responsible for the blue dot you see on the screenshot to the left. Although I call it a blue dot, it is actually a type of annotation specifically used for the current location of the device.
The result would be what you see to the right.