Manual task reordering feature (#6)
This PR contains the work done to add support for manual todo task reordering in the *Task list* view Reviewed-on: rock-n-code/todos-app#6 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #6.
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