Added support for todo deletion to the TaskListView view in the app target.

This commit is contained in:
2026-02-11 17:34:06 +01:00
parent 8324a64b24
commit 1debdcd322
2 changed files with 78 additions and 24 deletions
+16 -2
View File
@@ -9,6 +9,10 @@ struct TaskListView: View {
// MARK: Properties
/// The SwiftData model context for performing data operations.
@Environment(\.modelContext)
private var modelContext
/// The view model managing the state and business logic for this view.
///
/// This view model holds the group configuration and completion filter state.
@@ -40,8 +44,18 @@ struct TaskListView: View {
Content(
group: viewModel.group,
showCompleted: viewModel.showCompleted
) { tasks, source, destination in
viewModel.reorderTasks(tasks, from: source, to: destination)
) { tasks, offsets in
viewModel.deleteTasks(
tasks,
at: offsets,
from: modelContext
)
} onReorder: { tasks, source, destination in
viewModel.reorderTasks(
tasks,
from: source,
to: destination
)
}
.navigationTitle(viewModel.navigationTitle)
.toolbar {