From 1c1505505665d68abc50a724824bc713ca367f70 Mon Sep 17 00:00:00 2001 From: Alberto Paladino Date: Fri, 10 Dec 2021 17:10:44 +0100 Subject: [PATCH 1/2] Done button disabled settings --- Source/DateTimePicker.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/DateTimePicker.swift b/Source/DateTimePicker.swift index a504a93..46194a6 100644 --- a/Source/DateTimePicker.swift +++ b/Source/DateTimePicker.swift @@ -14,6 +14,12 @@ public protocol DateTimePickerDelegate: AnyObject { @objc public class DateTimePicker: UIView { + public var doneButtonIsEnabled: Bool = true { + didSet { + doneButton.isEnabled = doneButtonIsEnabled + } + } + var contentHeight: CGFloat = 330 public struct CustomFontSetting { From 3b79960845b50fc93339c5f69b014e2ad4568c8d Mon Sep 17 00:00:00 2001 From: "alberto.paladino" Date: Thu, 16 Dec 2021 11:53:32 +0100 Subject: [PATCH 2/2] Added autoSelectDayOnStopScroll var to avoid autoselecting day on scroll --- DateTimePickerDemo/Podfile.lock | 6 +++--- Source/DateTimePicker+CollectionView.swift | 8 ++++++-- Source/DateTimePicker.swift | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DateTimePickerDemo/Podfile.lock b/DateTimePickerDemo/Podfile.lock index dff3e3b..6951513 100644 --- a/DateTimePickerDemo/Podfile.lock +++ b/DateTimePickerDemo/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - DateTimePicker (2.5.1) + - DateTimePicker (2.5.3) DEPENDENCIES: - DateTimePicker (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - DateTimePicker: f7d3305252c1d7a67c9cca58ce8592f8396841ca + DateTimePicker: 52701ddf656a50856d3510955933f767cd2c947c PODFILE CHECKSUM: a26e66cb94802972f6430185232278dc132b5b0e -COCOAPODS: 1.9.3 +COCOAPODS: 1.11.2 diff --git a/Source/DateTimePicker+CollectionView.swift b/Source/DateTimePicker+CollectionView.swift index 10c8c0c..613bd68 100644 --- a/Source/DateTimePicker+CollectionView.swift +++ b/Source/DateTimePicker+CollectionView.swift @@ -55,11 +55,15 @@ extension DateTimePicker: UICollectionViewDataSource, UICollectionViewDelegate { } public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { - alignScrollView(scrollView) + if self.autoSelectDayOnStopScroll { + alignScrollView(scrollView) + } } public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { - alignScrollView(scrollView) + if self.autoSelectDayOnStopScroll { + alignScrollView(scrollView) + } } func alignScrollView(_ scrollView: UIScrollView) { diff --git a/Source/DateTimePicker.swift b/Source/DateTimePicker.swift index 46194a6..9bcf8cc 100644 --- a/Source/DateTimePicker.swift +++ b/Source/DateTimePicker.swift @@ -266,6 +266,9 @@ public protocol DateTimePickerDelegate: AnyObject { timeZone = calendar.timeZone } } + + public var autoSelectDayOnStopScroll: Bool = true + public var hapticFeedbackEnabled: Bool = true public var completionHandler: ((Date)->Void)?