From 63110b5ddaf6d85fa658bc1b1a1ef94de2153280 Mon Sep 17 00:00:00 2001 From: Basel Baragabah Date: Thu, 4 Jan 2024 13:19:09 +0300 Subject: [PATCH] fix disableSwipe stop working after last version --- Sources/FXDatePicker/Views/FXDatePickerView.swift | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Sources/FXDatePicker/Views/FXDatePickerView.swift b/Sources/FXDatePicker/Views/FXDatePickerView.swift index a525315..7464684 100644 --- a/Sources/FXDatePicker/Views/FXDatePickerView.swift +++ b/Sources/FXDatePicker/Views/FXDatePickerView.swift @@ -18,7 +18,7 @@ public struct FXDatePickerView: View { @Environment(\.layoutDirection) private var layoutDirection private var hideMarkers: Bool = false - @State private var disableSwipe: Bool = false + private var disableSwipe: Bool = false private var hideDatePicker: Bool = false @State private var dateRange: [Date] = [] @@ -121,15 +121,8 @@ public struct FXDatePickerView: View { openShowSelectedMonths ? SelectMonthPickerView(selectedDate: $selectedDate, calendar: calendar, calenderType: calenderType) .onChange(of: selectedDate, perform: { value in - disableSwipe = true displayedMonth = value setupCurrentDate() - - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { - disableSwipe = false - }) - - }) : nil @@ -162,7 +155,7 @@ public extension FXDatePickerView { } func disableSwipe(_ disable: Bool = true) -> FXDatePickerView { - let fxDatePicker = self + var fxDatePicker = self fxDatePicker.disableSwipe = disable return fxDatePicker }