From 5251b8fee365642046dd54cf9253d94114fb8970 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 10 Jul 2021 16:25:57 -0400 Subject: [PATCH] Using constant. --- Clocker/Panel/ParentPanelController+ModernSlider.swift | 4 ++-- Clocker/Panel/ParentPanelController.swift | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Clocker/Panel/ParentPanelController+ModernSlider.swift b/Clocker/Panel/ParentPanelController+ModernSlider.swift index 1e891202..bcd330eb 100644 --- a/Clocker/Panel/ParentPanelController+ModernSlider.swift +++ b/Clocker/Panel/ParentPanelController+ModernSlider.swift @@ -5,7 +5,7 @@ import Foundation extension ParentPanelController: NSCollectionViewDataSource { func collectionView(_: NSCollectionView, numberOfItemsInSection _: Int) -> Int { - return (96 * PanelConstants.modernSliderDaySupport * 2) + 1 + return (PanelConstants.modernSliderPointsInADay * PanelConstants.modernSliderDaySupport * 2) + 1 } func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { @@ -92,7 +92,7 @@ extension ParentPanelController { } public func setDefaultDateLabel(_ index: Int) -> Int { - let totalCount = (96 * PanelConstants.modernSliderDaySupport * 2) + 1 + let totalCount = (PanelConstants.modernSliderPointsInADay * PanelConstants.modernSliderDaySupport * 2) + 1 let centerPoint = Int(ceil(Double(totalCount / 2))) if index > (centerPoint + 1) { let remainder = (index % (centerPoint + 1)) diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index 8f265265..0c953d94 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -12,6 +12,7 @@ struct PanelConstants { static let yesWithQuestionMark = "Yes?" static let yesWithExclamation = "Yes!" static let modernSliderDaySupport = 5 + static let modernSliderPointsInADay = 96 } class ParentPanelController: NSWindowController {