|
|
@@ -44,7 +44,7 @@ struct ProjectPanelView: View {
|
|
|
Text("Created on \(item.timestamp, format: style)")
|
|
|
}
|
|
|
List {
|
|
|
- ForEach($item.tasks) { task in
|
|
|
+ ForEach($item.tasks.sorted(by: Task.less)) { task in
|
|
|
TaskView(task: task)
|
|
|
.swipeActions {
|
|
|
Button("Delete", systemImage: "trash", role: .destructive) {
|
|
|
@@ -52,7 +52,7 @@ struct ProjectPanelView: View {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ForEach(task.subtasks) { subtask in
|
|
|
+ ForEach(task.subtasks.sorted(by: SubTask.less)) { subtask in
|
|
|
SubTaskView(task: subtask)
|
|
|
.swipeActions {
|
|
|
Button("Delete", systemImage: "trash", role: .destructive) {
|
|
|
@@ -63,12 +63,18 @@ struct ProjectPanelView: View {
|
|
|
.onMove(perform: { indices, index in
|
|
|
withAnimation {
|
|
|
task.subtasks.wrappedValue.move(fromOffsets: indices, toOffset: index)
|
|
|
+ for (index, item) in task.subtasks.wrappedValue.enumerated() {
|
|
|
+ item.sortOrder = index
|
|
|
+ }
|
|
|
}
|
|
|
}).moveDisabled(!move)
|
|
|
}
|
|
|
.onMove(perform: { indices, index in
|
|
|
withAnimation {
|
|
|
item.tasks.move(fromOffsets: indices, toOffset: index)
|
|
|
+ for (index, item) in item.tasks.enumerated() {
|
|
|
+ item.sortOrder = index
|
|
|
+ }
|
|
|
}
|
|
|
}).moveDisabled(!move)
|
|
|
}
|