patchthecode/JTAppleCalendar

Selecting a large date range all at once shows a delay before loading app [Expected]. Suggestions wanted on how to improve this code.

開放

#1,201 建立於 2019年12月27日

 (12 則留言) (0 個反應) (1 位負責人)Swift (819 個分叉)batch import
help wanted

倉庫指標

星標
 (7,660 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Version Number: 8.0.2

Description

Function "selectDates(from startDate: Date, to endDate: Date, triggerSelectionDelegate: Bool = true, keepSelectionIfMultiSelectionAllowed: Bool = false)" freeze main thread in my app when I pass too long period between startDate and endDate (about six and more months).

Steps To Reproduce

func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
               var selectedDates = calendar.selectedDates
               if let start = selectedDates.min(), let end = selectedDates.max() {
                              calendar.selectDates(from: start, to: end, triggerSelectionDelegate: false, keepSelectionIfMultiSelectionAllowed: true)
               }
}

Expected Behavior

Not freeze main thread in app for a few seconds

貢獻者指南