File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,23 +2,28 @@ import SwiftUI
22
33struct TaskCard : View {
44 let taskItem : TaskItem
5+ var onToggleCompletion : ( ( ) -> Void ) ? = nil
56
67 var body : some View {
78 VStack ( alignment: . leading, spacing: 6 ) {
89 HStack {
9- if taskItem. status == " completed " {
10- Image ( systemName: " checkmark.circle.fill " )
11- . foregroundColor ( . green)
12- . padding ( . trailing, 2 )
13- } else {
14- Image ( systemName: " circle " )
15- . foregroundColor ( . gray)
16- . padding ( . trailing, 2 )
10+ Group {
11+ if taskItem. status == " completed " {
12+ Image ( systemName: " checkmark.circle.fill " )
13+ . foregroundColor ( . green)
14+ } else {
15+ Image ( systemName: " circle " )
16+ . foregroundColor ( . gray)
17+ }
18+ }
19+ . padding ( . trailing, 2 )
20+ . contentShape ( Rectangle ( ) )
21+ . onTapGesture {
22+ onToggleCompletion ? ( )
1723 }
1824
1925 Text ( taskItem. title ?? " (no title) " )
2026 . font ( . headline)
21-
2227 }
2328
2429 if let notes = taskItem. notes, !notes. isEmpty {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ private struct TaskRowView: View {
9797 let deleteTask : ( ) -> Void
9898
9999 var body : some View {
100- TaskCard ( taskItem: task)
100+ TaskCard ( taskItem: task, onToggleCompletion : toggleCompletion )
101101 . contentShape ( Rectangle ( ) )
102102 . onTapGesture ( perform: onTap)
103103 . swipeActions ( edge: . leading, allowsFullSwipe: true ) {
You can’t perform that action at this time.
0 commit comments