Added support for todo deletion to the TaskListView view in the app target.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user