Version: JTAppleCalendar (7.1.7)
allowsMultipleSelection = false
workflow:
calendarView.deselect(dates: [date]) by a button (control outside of the calendarView)What do I expect:
get deselected delegate call through
func calendar(_ calendar: JTAppleCalendarView, didDeselectDate date: Date, cell: JTAppleCell?, cellState: CellState) once at step 2.
What do I get:
get deselected delegate call 2 times: at step 2 and step 3 (I believe because collection view remembers that the item was selected).
Am I using the wrong method for deselection?
I am able to solve the issue by adding the line in the UserInteractionFunctions.swift:
public func deselect(dates: [Date], triggerSelectionDelegate: Bool = true) {
if allowsMultipleSelection {
selectDates(dates, triggerSelectionDelegate: triggerSelectionDelegate)
} else {
let paths = pathsFromDates(dates)
guard !paths.isEmpty else { return }
if paths.count > 1 { assert(false, "WARNING: you are trying to deselect multiple dates with allowsMultipleSelection == false. Only the first date will be deselected.")}
deselectItem(at: paths[0], animated: true)
collectionView(self, didDeselectItemAt: paths[0])
}
}
But maybe I am doing it wrong from the start and should use another method?
checking this out
I am not able to reproduce this.
Can you try to replicate it on the sample project i have attached to guthub?
Or can you provide a sample app which demonstrates this?
Hello @patchthecode
This one?
You can see unbalanced "deselect" (2 records) in the log if press the "Delete the date" button above the calendar and select a date afterward.
JTAppleCalendarDemo.zip
checking this out now
This is not happening with the file you gave me :/
Let me know know when you will be online.
Chat is faster -> https://gitter.im/patchthecode/JTAppleCalendar
Hello @patchthecode . I would like to deal with this now if you available
Video with the issue (check the textview at the bottom of the screen)

I have updated the pod in the sample project(was 7.1.5, now 7.1.7) and added a textview to see the output.
JTAppleCalendarDemo.zip
Xcode 10.1, iOS simulator 12.1
your issue is recreated.
Checking this now.
...bug
Fixed on master branch.
Can you check and let me know if it was fixed on master branch for your project?
Follow instructions here to test master branch. Let me know
Thank you.
I can not test the fix from master branch right now because of the "old" XCode version (10.1, Swift 4.2).
Cherry pick of the commit over the 7.1.7 tag fixes the issue though.
cool.
I am having this issue too. May you help me please
Hello @ekchhuon
Use the master branch or apply the fix manually. Current tag (7.1.7) does not include the solution of the issue.
By the way, you can check the example for the deselection code from my earlier comment
Exactly what @bivant said is correct.
If you need help let us know. I can help you.