mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Swipe to delete routes
This commit is contained in:
parent
787b7907a6
commit
1c190bb413
1 changed files with 12 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue