create a struct to delete every model automatically and use it
This commit is contained in:
1 parent
6100b9ebac
commit
f7953308b2
2 files changed
+9
-5
No files matched your search
@@ -29,10 +29,14 @@ struct WorldListToolbar : ViewModifier {
|
|||||||
isSelecting = false
|
isSelecting = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Button {
|
Menu {
|
||||||
//
|
//Faire le tri
|
||||||
}label: {
|
}label: {
|
||||||
Image(systemName: "line.3.horizontal.decrease")
|
Button {
|
||||||
|
//
|
||||||
|
}label: {
|
||||||
|
Image(systemName: "line.3.horizontal.decrease")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +73,7 @@ struct WorldListToolbar : ViewModifier {
|
|||||||
let shouldExitSelection = worldsToAction.count == worlds.count
|
let shouldExitSelection = worldsToAction.count == worlds.count
|
||||||
|
|
||||||
for world in worldsToAction {
|
for world in worldsToAction {
|
||||||
context.delete(world)
|
DeleteModel(modelContext: context).delete(world)
|
||||||
}
|
}
|
||||||
selectedWorlds.removeAll()
|
selectedWorlds.removeAll()
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button(role: .destructive){
|
Button(role: .destructive){
|
||||||
context.delete(world)
|
DeleteModel(modelContext: context).delete(world)
|
||||||
}label : {
|
}label : {
|
||||||
Label("Supprimer", systemImage: "trash")
|
Label("Supprimer", systemImage: "trash")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user