From b22cbcbff36592a9f7e342db3608abc5ad8738a9 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Apr 2023 21:51:57 -0700 Subject: [PATCH] Hook up route lines to toggle --- Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index 6e05c939..ea94739f 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -197,6 +197,13 @@ struct MapViewSwiftUI: UIViewRepresentable { lineIndex = 0 } } + } else { + // Remove all existing PolyLine Overlays + for overlay in mapView.overlays { + if overlay is MKPolyline { + mapView.removeOverlay(overlay) + } + } } //DispatchQueue.main.async {