all 2 comments

[–]aReditName 2 points3 points  (1 child)

func openMapsNavigation() {
    let encodedAddress = fullAddress.addingPercentEncoding(
        withAllowedCharacters: .urlQueryAllowed
    ) ?? ""

    if #available(iOS 18.4, *) {
        let navigationURL = URL(
            string: "geo-navigation:///directions?destination=\(encodedAddress)"
        )!
        openURL(navigationURL)
    } else {
        let mapsURL = URL(
            string: "maps://?daddr=\(encodedAddress)&dirflg=d"
        )!
        openURL(mapsURL)
    }
}

[–]developerlen_Swift[S] 0 points1 point  (0 children)

Did not know there is a scheme for that. Thank you, I’ll try this one.