Skip to content

Commit

Permalink
Update example project
Browse files Browse the repository at this point in the history
  • Loading branch information
bryankeller committed Dec 19, 2023
1 parent 950a0e9 commit 1f56320
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import UIKit

enum DayRangeSelectionHelper {

static func updateDayRange(afterTapSelectionOf day: Day, existingDayRange: inout DayRange?) {
static func updateDayRange(
afterTapSelectionOf day: DayComponents,
existingDayRange: inout DayComponentsRange?)
{
if
let _existingDayRange = existingDayRange,
_existingDayRange.lowerBound == _existingDayRange.upperBound,
Expand All @@ -31,9 +34,9 @@ enum DayRangeSelectionHelper {
}

static func updateDayRange(
afterDragSelectionOf day: Day,
existingDayRange: inout DayRange?,
initialDayRange: inout DayRange?,
afterDragSelectionOf day: DayComponents,
existingDayRange: inout DayComponentsRange?,
initialDayRange: inout DayComponentsRange?,
state: UIGestureRecognizer.State,
calendar: Calendar)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ final class DayRangeSelectionDemoViewController: BaseDemoViewController {

// MARK: Private

private var selectedDayRange: DayRange?
private var selectedDayRangeAtStartOfDrag: DayRange?
private var selectedDayRange: DayComponentsRange?
private var selectedDayRangeAtStartOfDrag: DayComponentsRange?

}
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ struct SwiftUIScreenDemo: View {

@StateObject private var calendarViewProxy = CalendarViewProxy()

@State private var selectedDayRange: DayRange?
@State private var selectedDayRangeAtStartOfDrag: DayRange?
@State private var selectedDayRange: DayComponentsRange?
@State private var selectedDayRangeAtStartOfDrag: DayComponentsRange?

private var selectedDateRanges: Set<ClosedRange<Date>> {
guard let selectedDayRange else { return [] }
Expand All @@ -189,7 +189,7 @@ struct SwiftUIScreenDemo: View {
return [selectedStartDate...selectedEndDate]
}

private func isDaySelected(_ day: Day) -> Bool {
private func isDaySelected(_ day: DayComponents) -> Bool {
if let selectedDayRange {
return day == selectedDayRange.lowerBound || day == selectedDayRange.upperBound
} else {
Expand Down

0 comments on commit 1f56320

Please sign in to comment.