From 096a02dabb6cc751592724161ad6412cf7d388cf Mon Sep 17 00:00:00 2001 From: Juny0110 Date: Sat, 19 Nov 2022 12:15:36 +0900 Subject: [PATCH] :sparkles: #21 Calendar Click event & Color --- .../StaticsView/View/CalendarView.swift | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/CalendarView.swift b/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/CalendarView.swift index 5120ebf..6422344 100644 --- a/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/CalendarView.swift +++ b/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/CalendarView.swift @@ -9,6 +9,9 @@ import SwiftUI struct CalendarView: View { @EnvironmentObject var dateHolder: DateHolder + @State private var selection: Bool? = false + @State private var columnIndex = 0 + @State private var rowIndex = 0 var body: some View { VStack { @@ -26,7 +29,22 @@ struct CalendarView: View { startingSpaces: startingSpaces, daysInMonth: daysInMonth, daysInPrevMonth: daysInPrevMonth - ).environmentObject(dateHolder) + ) + .background(Color.green) + .onTapGesture{ + + // TODO: - selection된 것에 따라 팝업 띄우기 + + self.selection = true + + // TODO: - 선택한 날짜 + + self.rowIndex = row + self.columnIndex = column + print([rowIndex, columnIndex]) + print(count - startingSpaces) + } + .environmentObject(dateHolder) } } }