Сделать это можно так:
let places: [Place] = [
.init(name: "One", coordinate: .init(latitude: 56.951924, longitude: 24.125584)),
.init(name: "Two", coordinate: .init(latitude: 56.967520, longitude: 24.105760)),
.init(name: "Five", coordinate: .init(latitude: 56.9539906, longitude: 24.13649290000000))
]
@State var coordinateRegion = MKCoordinateRegion(center: .init(latitude: 54.6872, longitude: 25.2797), latitudinalMeters: 2000000, longitudinalMeters: 2000000)
var body: some View {
Map(coordinateRegion: $coordinateRegion, annotationItems: places) { (place) in
MapAnnotation(coordinate: place.coordinate) {
Button(action: { print(place.name) }, label: {
Text(place.name)
})
}
}
}