Skip to content

Commit

Permalink
Merge pull request #62 from jeet-chanchawat/master
Browse files Browse the repository at this point in the history
My requirement was at least 1 date must always be selected.
  • Loading branch information
mmick66 committed Feb 22, 2019
2 parents ba3521a + 9e76325 commit f18a67f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions KDCalendar/CalendarView/CalendarView+Delegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ extension CalendarView: UICollectionViewDelegateFlowLayout {
if let index = selectedIndexPaths.index(of: indexPath) {

delegate?.calendar(self, didDeselectDate: date)

selectedIndexPaths.remove(at: index)
selectedDates.remove(at: index)
if enableDeslection {
selectedIndexPaths.remove(at: index)
selectedDates.remove(at: index)
}

} else {

Expand Down
1 change: 1 addition & 0 deletions KDCalendar/CalendarView/CalendarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public class CalendarView: UIView {

public var displayDate: Date?
public var multipleSelectionEnable = true
public var enableDeslection = true
public var marksWeekends = true

public var delegate: CalendarViewDelegate?
Expand Down

0 comments on commit f18a67f

Please sign in to comment.