Reputation: 178
I am working on calendar implementation.
I want current and past dates to be selectable, but not future dates, as my application only requires current and past dates.
How do I disable the selection of future dates in a calendar?
Upvotes: 0
Views: 287
Reputation: 2714
When a date is selected the JTAppleCalender view's delegate method didSelectDate
will be getting called.
So you could handle your date selection inside this method like,
func calendar(_ calendar: JTAppleCalendarView, didSelectDate date: Date, cell: JTAppleCell?, cellState: CellState) {
if date == currentDate || date == previousDate {
//do your logic here
}
else {
return
}
}
Upvotes: 2