Vodolazkyi / VACalendar

Custom Calendar for iOS in Swift
MIT License
198 stars 68 forks source link

calendarView setAvailableDates function taking long time to load calendar view #71

Open seekingdesti opened 1 year ago

seekingdesti commented 1 year ago

Hi,

I have 5 years dates in calendar, it's taking very long time to load calendar view. I i am using below function to load 5 years dates.

let avlblDates = datesRange(from: 01.01.2019, to: Date()) calendarView.setAvailableDates(DaysAvailability.some(avlblDates))

private func datesRange(from: Date, to: Date) -> [Date] { if from > to { return [Date]() } var tempDate = from var array = [tempDate]

    while tempDate < to {
        tempDate = Calendar.current.date(byAdding: .day, value: 1, to: tempDate)!
        array.append(tempDate)
    }
    return array
}

Please help me on this as it takes upto 10 seconds to load calendar view.

Thanks.
uzman commented 2 months ago