From 1c190bb41302d8d2de37e4f8f3619080c1233dce Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 22 Nov 2023 00:48:04 -0800 Subject: [PATCH] Swipe to delete routes --- Meshtastic/Views/Settings/Routes.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Meshtastic/Views/Settings/Routes.swift b/Meshtastic/Views/Settings/Routes.swift index 648d90e7..e9d614ce 100644 --- a/Meshtastic/Views/Settings/Routes.swift +++ b/Meshtastic/Views/Settings/Routes.swift @@ -110,6 +110,18 @@ struct Routes: View { .fill(Color(UIColor(hex: route.color >= 0 ? UInt32(route.color) : 0))) .frame(width: 20, height: 20) } + .swipeActions { + Button(role: .destructive) { + context.delete(route) + do { + try context.save() + } catch let error as NSError { + print("Error: \(error.localizedDescription)") + } + } label: { + Label("delete", systemImage: "trash") + } + } } .listStyle(.plain) }