From 767080a98314a61229366d6f4e64440b49f94832 Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Mon, 31 Aug 2026 08:23:07 +0100 Subject: [PATCH] watch: use MapKit directions handoff --- FuelBoardWatch Watch App/ContentView.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/FuelBoardWatch Watch App/ContentView.swift b/FuelBoardWatch Watch App/ContentView.swift index d8f75c3..410c023 100644 --- a/FuelBoardWatch Watch App/ContentView.swift +++ b/FuelBoardWatch Watch App/ContentView.swift @@ -1,6 +1,6 @@ import SwiftUI import Foundation -import WatchKit +import MapKit private enum WatchFuelType: String, CaseIterable, Identifiable, Codable { case e10 @@ -580,8 +580,14 @@ struct ContentView: View { } private func openMaps(latitude: Double, longitude: Double) { - guard let url = URL(string: "maps://?daddr=\(latitude),\(longitude)&t=d") else { return } - WKExtension.shared().openSystemURL(url) + let coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude) + let destination = MKMapItem(placemark: MKPlacemark(coordinate: coordinate)) + _ = MKMapItem.openMaps( + with: [MKMapItem.forCurrentLocation(), destination], + launchOptions: [ + MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving + ] + ) } }