From f80885f5d01b214e81ec75146ed1dcb2d5fa68a8 Mon Sep 17 00:00:00 2001 From: Kviatkovskii Sergei Date: Wed, 29 Mar 2023 14:08:19 +0300 Subject: [PATCH 1/2] trying to fix crash --- Sources/KVKCalendar/MonthView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/KVKCalendar/MonthView.swift b/Sources/KVKCalendar/MonthView.swift index 6c3a0a7d..02a632f4 100644 --- a/Sources/KVKCalendar/MonthView.swift +++ b/Sources/KVKCalendar/MonthView.swift @@ -111,7 +111,9 @@ final class MonthView: UIView { // to check when the calendarView is displayed on superview guard superview?.superview != nil && collectionView?.dataSource != nil else { return } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in + guard let self = self else { return } + if let attributes = self.collectionView?.layoutAttributesForSupplementaryElement(ofKind: UICollectionView.elementKindSectionHeader, at: IndexPath(row: 0, section: idx)), let inset = self.collectionView?.contentInset { let contentOffset: CGPoint @@ -127,6 +129,9 @@ final class MonthView: UIView { } self.collectionView?.setContentOffset(contentOffset, animated: animated) } else { + let index = IndexPath(row: 0, section: idx) + guard self.parameters.monthData.days[index] != nil else { return } + let scrollType: UICollectionView.ScrollPosition = self.style.month.scrollDirection == .horizontal ? .left : .top self.collectionView?.scrollToItem(at: IndexPath(row: 0, section: idx), at: scrollType, animated: animated) } From 0003639fe8059382829f967d0a4c5da31b9778ae Mon Sep 17 00:00:00 2001 From: Kviatkovskii Sergei Date: Sun, 7 May 2023 00:40:13 +0300 Subject: [PATCH 2/2] version up --- KVKCalendar.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KVKCalendar.podspec b/KVKCalendar.podspec index 07bdb126..0d533a5e 100644 --- a/KVKCalendar.podspec +++ b/KVKCalendar.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'KVKCalendar' - s.version = '0.6.13' + s.version = '0.6.14' s.summary = 'A most fully customization calendar for Apple platforms.' s.description = <<-DESC