0

I have a requirement where I need to open Apple's Maps application from my app with coordinates and a custom pin image. I am able to open the Maps application with coordinates but not with the custom pin image. I searched online and found that custom pin images can be set with MapKit, but I want to do it with Apple's Maps application. Is this possible to do with Swift? Any sort of help or direction would be greatly appreciated.

My code to open the Apple maps application:

func openAppleMap() {
 guard let lat = destinationLat else {return}
 guard let long = destinationLng else {return}
 let coordinate = CLLocationCoordinate2DMake(lat,long)
 let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, addressDictionary: nil))
 mapItem.name = "Destination"
 mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving])
}

There is no option to pass the custom pin image.

soundflix
3,14612 gold badges20 silver badges39 bronze badges
asked Sep 27, 2023 at 12:33

1 Answer 1

0

I don't think what you are asking for is possible.

You could display a map within your app using a custom pin image (Using the MapKit framework as you describe.) However I don't believe there is any mechanism to pass a custom pin image to Apple's Maps application.

answered Sep 27, 2023 at 13:30
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, greatly appreciate your help.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.