From b630821f109bb06f0feacf2de2486dcb7398ed47 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sat, 4 Mar 2023 16:33:28 -0800 Subject: [PATCH] Add distance from current location to annotation detail --- Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index 22d949e7..1f6977b1 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -242,6 +242,8 @@ struct MapViewSwiftUI: UIViewRepresentable { } else { annotationView.glyphImage = UIImage(systemName: "flipphone") } + let metersAway = positionAnnotation.coordinate.distance(from: LocationHelper.currentLocation) + subtitle.text! += NSLocalizedString("distance", comment: "") + ": \(distanceFormatter.string(fromDistance: Double(metersAway))) \n" subtitle.text! += positionAnnotation.time?.formatted() ?? "Unknown \n" subtitle.numberOfLines = 0 annotationView.detailCalloutAccessoryView = subtitle