Skip to content

Commit f09ed83

Browse files
authored
Merge pull request #47 from eunjooChoi/calendar_gesture
2 parents bc2c03d + 34ea1e9 commit f09ed83

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

PlantingMind/PlantingMind/Calender/CalendarGridView.swift

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ struct CalendarGridView: View {
2626
.onAppear(perform: {
2727
viewModel.fetch()
2828
})
29+
.gesture(DragGesture(minimumDistance: 10, coordinateSpace: .local)
30+
.onEnded { value in
31+
let horizontalAmount = value.translation.width
32+
let verticalAmount = value.translation.height
33+
34+
guard abs(horizontalAmount) > abs(verticalAmount) else { return }
35+
let addingValue = horizontalAmount < 0 ? 1 : -1
36+
viewModel.addingMonth(value: addingValue)
37+
})
2938
}
3039
}
3140

0 commit comments

Comments
 (0)