Skip to content

Commit

Permalink
Create some calendar cell constants
Browse files Browse the repository at this point in the history
  • Loading branch information
pakerwreah committed Apr 7, 2022
1 parent 917962b commit eea1f38
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Calendr/Calendar/CalendarViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ class CalendarViewModel {
calendarScaling = settings.calendarScaling

cellSize = calendarScaling
.map { 25 * $0 + 10 * ($0 - 1) }
.map { Constants.cellSize * $0 + 10 * ($0 - 1) }
.distinctUntilChanged()
.share(replay: 1)

weekNumbersWidth = Observable
.combineLatest(weekNumbers, cellSize)
.map { $0 != nil ? $1 * 0.85 : 0 }
.map { $0 != nil ? $1 * Constants.weekNumberCellRatio : 0 }
.distinctUntilChanged()
.share(replay: 1)
}
Expand All @@ -240,3 +240,9 @@ private extension CalendarCellViewModel {
)
}
}

private enum Constants {

static let cellSize: CGFloat = 25
static let weekNumberCellRatio: CGFloat = 0.85
}

0 comments on commit eea1f38

Please sign in to comment.