VACalendar
VACalendar copied to clipboard
Delegate method "selectedDate(_ date: Date)" not called, if a day already selected.
I can't get a date, if a day already selected.
I think, nothing will be break if the method
calendarDelegate?.selectedDate?(day.date)
will call before the line
guard day.state == .available else { return }
original code: ` extension VACalendarView: VAMonthViewDelegate {
func dayStateChanged(_ day: VADay, in month: VAMonth) {
switch selectionStyle {
case .single:
guard day.state == .available else { return }
calendar.deselectAll()
calendar.setDaySelectionState(day, state: .selected)
calendarDelegate?.selectedDate?(day.date)
case .multi:
calendar.setDaySelectionState(day, state: day.reverseSelectionState)
}
}
}`
Hello ATrotsenko,
Comment below line from your code.
// guard day.state == .available else { return } // comment for click same date
// calendar.deselectAll() // calendar.setDaySelectionState(day, state: .selected) // calendarDelegate?.selectedDate?(day.date)
STUCKED ON SAME.
by the way this upper suggestion is working,
do change in VACalendarView-
comment - // guard day.state == .available else { return } and you will get action on selected date.