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