Hi everybody, in my app I have a button that open a destination in maps, the problem is that after maps launching, the destination is unknown location , is possible to make it appear with the name and the information provided by maps?
This is my situation
and this is what I would do
is it possible?
this is my code
import SwiftUI
import CoreLocation
import MapKit
import Contacts
var body: some View {
HStack {
MapView()
Button(action: {MapView().openMaps()}) {
Text("GO!")
}
}
}
func openMaps() {
let coordinate = CLLocationCoordinate2D(latitude: 41.928435, longitude: 12.466579)
let placemark = MKPlacemark(coordinate: coordinate)
let mapItem = MKMapItem(placemark: placemark)
mapItem.openInMaps()
}