Skip to content

Commit

Permalink
Merge pull request #328 from chiliec/feature/disabled-selection-style
Browse files Browse the repository at this point in the history
Add disabled selection mode
  • Loading branch information
kvyatkovskys authored Sep 12, 2023
2 parents fd23f56 + 9dca31f commit 2ec8e92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Sources/KVKCalendar/MonthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ extension MonthView: UICollectionViewDataSource, UICollectionViewDataSourcePrefe
cell.selectDate = parameters.monthData.selectedDates.contains(date) ? date : parameters.monthData.date
case .single:
cell.selectDate = parameters.monthData.date
case .disabled:
break
}

cell.style = style
Expand Down Expand Up @@ -469,6 +471,8 @@ extension MonthView: UICollectionViewDelegate, UICollectionViewDelegateFlowLayou
didSelectDates(parameters.monthData.selectedDates.compactMap({ $0 }), indexPath: item.indexPath)
case .single:
didSelectDates([date], indexPath: item.indexPath)
case .disabled:
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/KVKCalendar/Style.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public struct MonthStyle {
public var heightSectionHeader: CGFloat = 50

public enum SelectionMode: Int {
case single, multiple
case single, multiple, disabled
}
}

Expand Down

0 comments on commit 2ec8e92

Please sign in to comment.