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 + ] + ) } }