Added support the user reordering of todo tasks for the TaskListView view in the app target.

This commit is contained in:
2026-02-11 16:26:21 +01:00
parent 1e3cdbdd3f
commit 8956b782c3
3 changed files with 101 additions and 10 deletions
+9 -1
View File
@@ -19,7 +19,13 @@ struct TaskListView: View {
/// Creates a new task list view for a specific group.
///
/// Initializes the view with a view model configured for the specified group.
/// The view model manages the state for completion filtering and task reordering,
/// while the view handles the presentation layer including navigation and toolbar.
///
/// - Parameter group: The todo group category to display tasks for.
/// - Note: The group determines which tasks are fetched, whether
/// completion filtering is available, and whether drag and drop reordering is enabled.
init(group: TodoGroup) {
_viewModel = .init(initialValue: ViewModel(group: group))
}
@@ -34,7 +40,9 @@ struct TaskListView: View {
Content(
group: viewModel.group,
showCompleted: viewModel.showCompleted
)
) { tasks, source, destination in
viewModel.reorderTasks(tasks, from: source, to: destination)
}
.navigationTitle(viewModel.navigationTitle)
.toolbar {
if viewModel.canShowCompleted {