Calendar implementation on swift

282 views Asked by At

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?

1

There are 1 answers

7
Aravind A R On

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
        }
    }