Todo repository protocol #8

Merged
javier merged 11 commits from app/repository-protocol into main 2026-02-11 18:22:26 +00:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 61adf5387f - Show all commits
@@ -87,21 +87,21 @@ extension TaskListView {
/// Deletes tasks at the specified indices.
///
/// This method removes tasks from the model context after a swipe-to-delete action.
/// The deletion is performed through SwiftData's model context, which handles
/// This method removes tasks from the repository after a swipe-to-delete action.
/// The deletion is performed through the repository, which handles
/// persistence and triggers automatic UI updates.
///
/// - Parameters:
/// - tasks: The current array of tasks.
/// - offsets: The index set of tasks to delete.
/// - modelContext: The SwiftData model context to perform the deletion.
func deleteTasks(
/// - repository: The repository to perform the deletion.
func delete(
_ tasks: [Todo],
at offsets: IndexSet,
from modelContext: ModelContext
from repository: Repository
) {
for index in offsets {
modelContext.delete(tasks[index])
repository.delete(tasks[index])
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ struct TaskListView: View {
group: viewModel.group,
showCompleted: viewModel.showCompleted
) { tasks, offsets in
viewModel.deleteTasks(
viewModel.delete(
tasks,
at: offsets,
from: modelContext