From 0c34ef9e10d98a9c7df6671baa281bc496640073 Mon Sep 17 00:00:00 2001 From: JayT Date: Sun, 19 May 2019 22:22:09 -0400 Subject: [PATCH 001/109] removed code duplication --- Sources/JTACYearView.swift | 4 +--- Sources/JTAppleMonthView.swift | 12 ++---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Sources/JTACYearView.swift b/Sources/JTACYearView.swift index 5ef98d0d..69176419 100644 --- a/Sources/JTACYearView.swift +++ b/Sources/JTACYearView.swift @@ -65,9 +65,7 @@ open class JTACYearView: UICollectionView { } - - -extension JTACYearView: JTAppleMonthCellDelegate { +extension JTACYearView: JTAppleMonthViewDelegate { public func monthView(_ monthView: JTAppleMonthView, drawingFor segmentRect: CGRect, with date: Date, dateOwner: DateOwner, monthIndex: Int) -> (UIImage, CGRect)? { return calendarDelegate?.calendar(self, monthView: monthView, drawingFor: segmentRect, with: date, dateOwner: dateOwner, monthIndex: monthIndex) } diff --git a/Sources/JTAppleMonthView.swift b/Sources/JTAppleMonthView.swift index d7e1e3f0..c78a54e3 100644 --- a/Sources/JTAppleMonthView.swift +++ b/Sources/JTAppleMonthView.swift @@ -29,22 +29,14 @@ public protocol JTAppleMonthViewDelegate: class { monthIndex: Int) -> (UIImage, CGRect)? } -public protocol JTAppleMonthCellDelegate: class { - func monthView(_ monthView: JTAppleMonthView, - drawingFor segmentRect: CGRect, - with date: Date, - dateOwner: DateOwner, - monthIndex: Int) -> (UIImage, CGRect)? -} - open class JTAppleMonthCell: UICollectionViewCell { @IBOutlet var monthView: JTAppleMonthView? - weak var delegate: JTAppleMonthCellDelegate? + weak var delegate: JTAppleMonthViewDelegate? func setupWith(configurationParameters: ConfigurationParameters, month: Month, date: Date, - delegate: JTAppleMonthCellDelegate) { + delegate: JTAppleMonthViewDelegate) { guard let monthView = monthView else { assert(false); return } self.delegate = delegate monthView.setupWith(configurationParameters: configurationParameters, From 30380cb6c631a2233cd831d04e5a5ff62c2dab8a Mon Sep 17 00:00:00 2001 From: JayT Date: Mon, 20 May 2019 01:43:10 -0400 Subject: [PATCH 002/109] code cleanup --- Sources/JTACScrollViewDelegates.swift | 88 ++++++++------------------- 1 file changed, 24 insertions(+), 64 deletions(-) diff --git a/Sources/JTACScrollViewDelegates.swift b/Sources/JTACScrollViewDelegates.swift index 79e388fd..09bf6a3c 100644 --- a/Sources/JTACScrollViewDelegates.swift +++ b/Sources/JTACScrollViewDelegates.swift @@ -94,72 +94,32 @@ extension JTACMonthView: UIScrollViewDelegate { fixed: { return theCurrentSection}) guard section >= 0, section < calendarLayout.endOfSectionOffsets.count else {setTargetContentOffset(0); return} - - - let x = calendarLayout.endOfSectionOffsets[theCurrentSection] - let pp = theCurrentSection - 1 < 0 ? 0 : theCurrentSection - 1 - let y = calendarLayout.endOfSectionOffsets[pp] - let midPoint = (x+y)/2 + let endOfCurrentSectionOffset = calendarLayout.endOfSectionOffsets[theCurrentSection] + let endOfPreviousSectionOffset = calendarLayout.endOfSectionOffsets[theCurrentSection - 1 < 0 ? 0 : theCurrentSection - 1] + let midPoint = (endOfCurrentSectionOffset + endOfPreviousSectionOffset) / 2 let maxSnap = calendarLayout.endOfSectionOffsets[section] - let xp: CGFloat = 20 - let userPercentage = CGFloat((100 - xp) / 100.0) - - let snapForward = midPoint - ((maxSnap - midPoint) * userPercentage) - + let userPercentage: CGFloat = 20 + let modifiedPercentage = CGFloat((100 - userPercentage) / 100.0) + let snapForward = midPoint - ((maxSnap - midPoint) * modifiedPercentage) scrollDecision(currentScrollDirectionValue: translation, previousScrollDirectionValue: lastMovedScrollDirection, forward: { - - - print("midPoint = \(midPoint)") - print("CurrentContentOffset = \(theCurrentContentOffset)") - print("CurrentSection = \(theCurrentSection)") - print("snapForward = \(snapForward)") -// print("snapBack = \(snapBack)") - print("x = \(x)") - print("y = \(y)\n\n\n") - - if theCurrentContentOffset >= snapForward { - setTargetContentOffset(x) - } else { - setTargetContentOffset(y) - } - }, + if theCurrentContentOffset >= snapForward { + setTargetContentOffset(endOfCurrentSectionOffset) + } else { + setTargetContentOffset(endOfPreviousSectionOffset) + } + }, backward: { - if theCurrentContentOffset <= snapForward { - setTargetContentOffset(y) - } else { - setTargetContentOffset(x) - } - }) -// if isForward { -// -// print("isScrollingFowrard = \(isForward)") -// print("midPoint = \(midPoint)") -// print("CurrentContentOffset = \(theCurrentContentOffset)") -// print("CurrentSection = \(theCurrentSection)") -// print("snapForward = \(snapForward)") -// print("snapBack = \(snapBack)") -// print("x = \(x)") -// print("y = \(y)\n\n\n") -// -// if theCurrentContentOffset >= snapForward { -// setTargetContentOffset(x) -// } else { -// setTargetContentOffset(y) -// } -// } else { -// if theCurrentContentOffset <= snapForward { -// setTargetContentOffset(y) -// } else { -// setTargetContentOffset(x) -// } -// } - - + if theCurrentContentOffset <= snapForward { + setTargetContentOffset(endOfPreviousSectionOffset) + } else { + setTargetContentOffset(endOfCurrentSectionOffset) + } + }) case let .nonStopToCell(withResistance: resistance), let .nonStopToSection(withResistance: resistance): let (recalculatedOffset, elementProperties) = rectAfterApplying(resistance: resistance, @@ -183,8 +143,8 @@ extension JTACMonthView: UIScrollViewDelegate { case .nonStopToSection: let stopSection = scrollDecision(currentScrollDirectionValue: translation, previousScrollDirectionValue: lastMovedScrollDirection, - forward: { () -> Int in return validElementProperties.section }, - backward: {() -> Int in return validElementProperties.section - 1}) + forward: { validElementProperties.section }, + backward: {validElementProperties.section - 1}) let calculatedOffSet = (stopSection < 0 || stopSection > calendarLayout.endOfSectionOffsets.count - 1) ? 0 : calendarLayout.endOfSectionOffsets[stopSection] setTargetContentOffset(calculatedOffSet) @@ -195,13 +155,13 @@ extension JTACMonthView: UIScrollViewDelegate { let diffResist = diffResistance(targetOffset: theTargetContentOffset, currentOffset: theCurrentContentOffset, resistance: resistance) let recalculatedOffsetAfterResistance = scrollDecision(currentScrollDirectionValue: translation, previousScrollDirectionValue: lastMovedScrollDirection, - forward: { () -> CGFloat in return theTargetContentOffset - diffResist }, - backward: { () -> CGFloat in return theTargetContentOffset + diffResist }) + forward: { theTargetContentOffset - diffResist }, + backward: { theTargetContentOffset + diffResist }) let offset = scrollDecision(currentScrollDirectionValue: translation, previousScrollDirectionValue: lastMovedScrollDirection, - forward: { () -> CGFloat in return ceil(recalculatedOffsetAfterResistance / interval) * interval }, - backward: { () -> CGFloat in floor(recalculatedOffsetAfterResistance / interval) * interval }) + forward: { ceil(recalculatedOffsetAfterResistance / interval) * interval }, + backward: { floor(recalculatedOffsetAfterResistance / interval) * interval }) setTargetContentOffset(offset) case .none: break From a9a9cca9141ba3e09083a81eb3c7abab83613943 Mon Sep 17 00:00:00 2001 From: JayT Date: Mon, 20 May 2019 01:45:24 -0400 Subject: [PATCH 003/109] code cleanup --- Sources/JTACScrollViewDelegates.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/JTACScrollViewDelegates.swift b/Sources/JTACScrollViewDelegates.swift index 09bf6a3c..daefd75c 100644 --- a/Sources/JTACScrollViewDelegates.swift +++ b/Sources/JTACScrollViewDelegates.swift @@ -77,7 +77,6 @@ extension JTACMonthView: UIScrollViewDelegate { previousScrollDirectionValue: lastMovedScrollDirection, forward: { () -> CGFloat in return ceil(theCurrentContentOffset / interval) * interval }, backward: { () -> CGFloat in return floor(theCurrentContentOffset / interval) * interval}) - print("Before: \(offset)") setTargetContentOffset(offset) case let .stopAtEach(customInterval: interval): From a4c18725a485b86c6a21a49ef23d7f632c213352 Mon Sep 17 00:00:00 2001 From: JayT Date: Mon, 20 May 2019 01:54:04 -0400 Subject: [PATCH 004/109] Final renaming convention --- .../Base.lproj/Main.storyboard | 100 +++++++++--------- .../TestYearViewViewController.swift | 8 +- JTAppleCalendar.xcodeproj/project.pbxproj | 12 +-- Sources/JTACInteractionYearFunctions.swift | 6 +- ...pleMonthView.swift => JTACMonthCell.swift} | 26 ++--- Sources/JTACYearView.swift | 4 +- Sources/JTACYearViewProtocols.swift | 6 +- 7 files changed, 79 insertions(+), 83 deletions(-) rename Sources/{JTAppleMonthView.swift => JTACMonthCell.swift} (90%) diff --git a/Example/JTAppleCalendar iOS Example/Base.lproj/Main.storyboard b/Example/JTAppleCalendar iOS Example/Base.lproj/Main.storyboard index dddc9946..35cba6f9 100644 --- a/Example/JTAppleCalendar iOS Example/Base.lproj/Main.storyboard +++ b/Example/JTAppleCalendar iOS Example/Base.lproj/Main.storyboard @@ -1,10 +1,6 @@ - - - - @@ -712,20 +708,20 @@ - + - + - + @@ -807,11 +803,11 @@ - + - + @@ -824,13 +820,13 @@ - + - + @@ -856,7 +852,7 @@ - + @@ -910,11 +906,11 @@ - + - + + + + + + @@ -578,49 +583,49 @@ - + + ## Contributors This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. @@ -48,20 +60,6 @@ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com -## Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/JTAppleCalendar#sponsor)] - - - - - - - - - - - From ad03e62acb5a33be09f1909ae7905c07b3cfcc7e Mon Sep 17 00:00:00 2001 From: criRob <93618370+criRob@users.noreply.github.com> Date: Wed, 11 May 2022 09:39:20 -0500 Subject: [PATCH 065/109] Update JTAppleCalendar.podspec --- JTAppleCalendar.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JTAppleCalendar.podspec b/JTAppleCalendar.podspec index 1cb6da5c..a8c9ffd6 100644 --- a/JTAppleCalendar.podspec +++ b/JTAppleCalendar.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "JTAppleCalendar" - s.version = "8.0.3" + s.version = "8.0.4" s.summary = "The Unofficial Swift Apple Calendar Library. View. Control. for iOS & tvOS" s.description = <<-DESC A highly configurable Apple calendar control. Contains features like boundary dates, month and week view. Very light weight. From 00a6d472f19e26da855c3aaecf3e9afc92408ac4 Mon Sep 17 00:00:00 2001 From: criRob <93618370+criRob@users.noreply.github.com> Date: Wed, 11 May 2022 09:44:33 -0500 Subject: [PATCH 066/109] Updated podspec to 8.0.4 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 515d62aa..ea288c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. `JTAppleCalendar` adheres to [Semantic Versioning](http://semver.org/). #### 8.x Releases -- `8.0.0` Releases - [8.0.0](#800)|[8.0.1](#801)|[8.0.2](#802)|[8.0.3](#803) +- `8.0.0` Releases - [8.0.0](#800)|[8.0.1](#801)|[8.0.2](#802)|[8.0.3](#803)|[8.0.4](#804) #### 7.x Releases - `7.1.0` Releases - [7.1.0](#710)|[7.1.1](#711)|[7.1.2](#712)|[7.1.3](#713)|[7.1.4](#714)|[7.1.5](#715)|[7.1.6](#716)|[7.1.7](#717) - `7.0.0` Releases - [7.0.0](#700)|[7.0.1](#701)|[7.0.2](#702)|[7.0.3](#703)|[7.0.4](#704)|[7.0.5](#705)|[7.0.6](#706) @@ -31,6 +31,8 @@ All notable changes to this project will be documented in this file. - `1.0.x` Releases - [1.0.0](#100) --- +## [8.0.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.4) +- fixed warnings (https://github.com/patchthecode/JTAppleCalendar/issues/1307) ## [8.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.3) - [removed side effect on allowsRangedSelection](https://github.com/patchthecode/JTAppleCalendar/issues/1122) - Carthage tag now works again. From 31c00c4215e5ae2ab97cd0415cdd41acaebef1f1 Mon Sep 17 00:00:00 2001 From: Diego Rozensztejn Date: Mon, 4 Nov 2019 15:15:10 -0500 Subject: [PATCH 067/109] Fixes #1165: Incorrect method 'scrollToDate()' in JTACMonthView --- .../JTACInteractionMonthFunctions.swift | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 43a1cf31..770375c7 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -528,6 +528,7 @@ extension JTACMonthView { self.scrollToDate(date, triggerScrollToDateDelegate: triggerScrollToDateDelegate, animateScroll: animateScroll, + preferredScrollPosition: preferredScrollPosition, extraAddedOffset: extraAddedOffset, completionHandler: completionHandler) } @@ -547,16 +548,21 @@ extension JTACMonthView { if retrievedPathsFromDates.isEmpty { return } let sectionIndexPath = pathsFromDates([date])[0] - guard let point = targetPointForItemAt(indexPath: sectionIndexPath) else { - assert(false, "Could not determine CGPoint. This is an error. contact developer on github. In production, there will not be a crash, but scrolling will not occur") - return + if scrollingMode == .none { + self.scrollToItem(at: sectionIndexPath, + at: preferredScrollPosition ?? (scrollDirection == .horizontal ? .left : .top), + animated: true) + } else { + guard let point = targetPointForItemAt(indexPath: sectionIndexPath) else { + assert(false, "Could not determine CGPoint. This is an error. contact developer on github. In production, there will not be a crash, but scrolling will not occur") + return + } + scrollTo(point: point, + triggerScrollToDateDelegate: triggerScrollToDateDelegate, + isAnimationEnabled: animateScroll, + extraAddedOffset: extraAddedOffset, + completionHandler: completionHandler) } - - scrollTo(point: point, - triggerScrollToDateDelegate: triggerScrollToDateDelegate, - isAnimationEnabled: animateScroll, - extraAddedOffset: extraAddedOffset, - completionHandler: completionHandler) } /// Scrolls the calendar view to the start of a section view header. From 72e4ac3b5a5af8abe5c094aceefc00801044dfa4 Mon Sep 17 00:00:00 2001 From: Diego Rozensztejn Date: Mon, 4 Nov 2019 15:29:43 -0500 Subject: [PATCH 068/109] Respecting animation parameter --- Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 770375c7..6285d52e 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -551,7 +551,7 @@ extension JTACMonthView { if scrollingMode == .none { self.scrollToItem(at: sectionIndexPath, at: preferredScrollPosition ?? (scrollDirection == .horizontal ? .left : .top), - animated: true) + animated: animateScroll) } else { guard let point = targetPointForItemAt(indexPath: sectionIndexPath) else { assert(false, "Could not determine CGPoint. This is an error. contact developer on github. In production, there will not be a crash, but scrolling will not occur") From 61c7128ad3c68e1af42b5de37ab82a416f9ca0c5 Mon Sep 17 00:00:00 2001 From: PatchTheCode Date: Thu, 18 Aug 2022 06:38:32 -0400 Subject: [PATCH 069/109] Delete FUNDING.yml --- .github/FUNDING.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index cfbb8b45..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: patchthecode -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 0397b23d1d11fb822bc5ec3cf237c2404e2b2508 Mon Sep 17 00:00:00 2001 From: Florent Morin Date: Mon, 5 Jun 2023 16:27:14 -0700 Subject: [PATCH 070/109] Fix Xcode 15 compilation --- Sources/JTAppleCalendar/JTACMonthView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACMonthView.swift b/Sources/JTAppleCalendar/JTACMonthView.swift index 59fde969..fcb74434 100644 --- a/Sources/JTAppleCalendar/JTACMonthView.swift +++ b/Sources/JTAppleCalendar/JTACMonthView.swift @@ -63,8 +63,6 @@ open class JTACMonthView: UICollectionView { /// then whenever you click on a datecell, you may notice a very fast /// refreshing of the date-cells both left and right of the cell you /// just selected. - @available(*, unavailable, renamed: "allowsRangedSelection") - open var isRangeSelectionUsed: Bool = false open var allowsRangedSelection: Bool = false open var rangeSelectionMode: RangeSelectionMode = .segmented From b5fc43a79a7f8d65793eaee55e27fbf8646eff2e Mon Sep 17 00:00:00 2001 From: PatchTheCode Date: Tue, 6 Jun 2023 10:30:05 -0400 Subject: [PATCH 071/109] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e11c004..6cf16d56 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,7 @@ ___ Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Want to become a sponsor? Send an email to patchthecode@gmail.com -![Scheduling API](https://user-images.githubusercontent.com/9488406/125080407-0dd25780-e0c5-11eb-9f70-ef958968674a.png) -This project is sponsored by **Spurwing**, where their API Makes Adding Scheduling Quick, Reliable and Scalable. Use Spurwing to build and integrate Scheduling, Booking & Calendar features in your project. Read more about Spurwing's [**Scheduling API**](https://www.spurwing.io/). + From cde5b18fdaebb03f7e395b41883843d82e31bc55 Mon Sep 17 00:00:00 2001 From: jeron_thomas Date: Wed, 7 Jun 2023 08:33:32 -0400 Subject: [PATCH 072/109] - Updated errors on latest iOS update - added previous mast4er commit to release 8.0.5 --- .gitignore | 1 + CHANGELOG.md | 6 +++++- JTAppleCalendar.podspec | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dd9d595d..15e0f003 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ Carthage /.swiftlint.yml /.swift-version /Index +xbcbb2nb diff --git a/CHANGELOG.md b/CHANGELOG.md index ea288c17..92533c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. `JTAppleCalendar` adheres to [Semantic Versioning](http://semver.org/). #### 8.x Releases -- `8.0.0` Releases - [8.0.0](#800)|[8.0.1](#801)|[8.0.2](#802)|[8.0.3](#803)|[8.0.4](#804) +- `8.0.0` Releases - [8.0.0](#800)|[8.0.1](#801)|[8.0.2](#802)|[8.0.3](#803)|[8.0.4](#804)|[8.0.5](#805) #### 7.x Releases - `7.1.0` Releases - [7.1.0](#710)|[7.1.1](#711)|[7.1.2](#712)|[7.1.3](#713)|[7.1.4](#714)|[7.1.5](#715)|[7.1.6](#716)|[7.1.7](#717) - `7.0.0` Releases - [7.0.0](#700)|[7.0.1](#701)|[7.0.2](#702)|[7.0.3](#703)|[7.0.4](#704)|[7.0.5](#705)|[7.0.6](#706) @@ -31,6 +31,10 @@ All notable changes to this project will be documented in this file. - `1.0.x` Releases - [1.0.0](#100) --- +## [8.0.5](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.5) +- fixed latest iOS update issues (https://github.com/patchthecode/JTAppleCalendar/pull/1370) +- Respect animation parameter (https://github.com/patchthecode/JTAppleCalendar/commit/72e4ac3b5a5af8abe5c094aceefc00801044dfa4) +- Added preferred position is scoll mode is .none (https://github.com/patchthecode/JTAppleCalendar/commit/31c00c4215e5ae2ab97cd0415cdd41acaebef1f1#diff-0471218aece98915af0d556e7389b414ef1397d811c0fbf94d96ea8323bdc9a4R551-R564) ## [8.0.4](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.4) - fixed warnings (https://github.com/patchthecode/JTAppleCalendar/issues/1307) ## [8.0.3](https://github.com/patchthecode/JTAppleCalendar/releases/tag/8.0.3) diff --git a/JTAppleCalendar.podspec b/JTAppleCalendar.podspec index a8c9ffd6..7442a521 100644 --- a/JTAppleCalendar.podspec +++ b/JTAppleCalendar.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "JTAppleCalendar" - s.version = "8.0.4" + s.version = "8.0.5" s.summary = "The Unofficial Swift Apple Calendar Library. View. Control. for iOS & tvOS" s.description = <<-DESC A highly configurable Apple calendar control. Contains features like boundary dates, month and week view. Very light weight. From eda74e195893b75bc099a82dcf9c980b71ed2e04 Mon Sep 17 00:00:00 2001 From: jeron_thomas Date: Wed, 7 Jun 2023 11:28:44 -0400 Subject: [PATCH 073/109] Other fixes to pass build --- JTAppleCalendar.xcodeproj/project.pbxproj | 4 ++-- Package.swift | 2 +- Sources/JTAppleCalendar/JTACVariables.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/JTAppleCalendar.xcodeproj/project.pbxproj b/JTAppleCalendar.xcodeproj/project.pbxproj index dfc45cb6..c747f604 100644 --- a/JTAppleCalendar.xcodeproj/project.pbxproj +++ b/JTAppleCalendar.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/JTAppleCalendar/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -390,7 +390,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/JTAppleCalendar/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Package.swift b/Package.swift index 3bb1c0f5..76b61a28 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ import PackageDescription let package = Package( name: "JTAppleCalendar", platforms: [ - .iOS(.v10), + .iOS(.v11), ], products: [ .library( diff --git a/Sources/JTAppleCalendar/JTACVariables.swift b/Sources/JTAppleCalendar/JTACVariables.swift index f8f6229e..37983e0e 100644 --- a/Sources/JTAppleCalendar/JTACVariables.swift +++ b/Sources/JTAppleCalendar/JTACVariables.swift @@ -56,7 +56,7 @@ extension JTACMonthView { } /// Returns all selected dates - open var selectedDates: [Date] { + public var selectedDates: [Date] { return selectedDatesSet.sorted() } From 718f0ab68ba0fcd2bc134f6e9d30edc1b9b038e1 Mon Sep 17 00:00:00 2001 From: jeron_thomas Date: Wed, 7 Jun 2023 12:56:14 -0400 Subject: [PATCH 074/109] Updated min version to 11.0 --- JTAppleCalendar.podspec | 4 ++-- JTAppleCalendar.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/JTAppleCalendar.podspec b/JTAppleCalendar.podspec index 7442a521..8a299d86 100644 --- a/JTAppleCalendar.podspec +++ b/JTAppleCalendar.podspec @@ -14,8 +14,8 @@ A highly configurable Apple calendar control. Contains features like boundary da s.swift_version = '5' - s.ios.deployment_target = '10.0' - s.tvos.deployment_target = '10.0' + s.ios.deployment_target = '11.0' + s.tvos.deployment_target = '11.0' s.source_files = 'Sources/JTAppleCalendar/*.swift' end diff --git a/JTAppleCalendar.xcodeproj/project.pbxproj b/JTAppleCalendar.xcodeproj/project.pbxproj index c747f604..fd4e6575 100644 --- a/JTAppleCalendar.xcodeproj/project.pbxproj +++ b/JTAppleCalendar.xcodeproj/project.pbxproj @@ -281,7 +281,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -338,7 +338,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; From b94bc4f3c81d58c7876db0aa1f0a2944bf459650 Mon Sep 17 00:00:00 2001 From: patchthecode Date: Sat, 30 Sep 2023 09:57:16 -0400 Subject: [PATCH 075/109] https://github.com/patchthecode/JTAppleCalendar/issues/1375 --- .../JTAppleCalendar/JTACInteractionMonthFunctions.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 6285d52e..6c6b1b88 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -215,7 +215,13 @@ extension JTACMonthView { /// - Parameter completionHandler: This closure will run after /// the reload is complete public func reloadData(withAnchor date: Date? = nil, completionHandler: (() -> Void)? = nil) { - if isReloadDataInProgress { return } + if isReloadDataInProgress { + calendarViewLayout.delayedExecutionClosure.append {[weak self] in + guard let _ = self else { return } + completionHandler?() + } + return + } if isScrollInProgress { scrollDelayedExecutionClosure.append {[unowned self] in self.reloadData(completionHandler: completionHandler) From a3a688603032d88c1f133c5f8eb5b8f2a7be9950 Mon Sep 17 00:00:00 2001 From: patchthecode Date: Sat, 30 Sep 2023 09:57:51 -0400 Subject: [PATCH 076/109] uncommited code --- SampleJTAppleCalendar/Example Calendars/ViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleJTAppleCalendar/Example Calendars/ViewController.swift b/SampleJTAppleCalendar/Example Calendars/ViewController.swift index 10bb9746..52102392 100644 --- a/SampleJTAppleCalendar/Example Calendars/ViewController.swift +++ b/SampleJTAppleCalendar/Example Calendars/ViewController.swift @@ -288,7 +288,7 @@ class ViewController: UIViewController { func handleCellConfiguration(cell: JTACDayCell?, cellState: CellState) { handleCellSelection(view: cell, cellState: cellState) handleCellTextColor(view: cell, cellState: cellState) -// prePostVisibility?(cellState, cell as? CellView) + prePostVisibility?(cellState, cell as? CellView) } From 6b1f96bfcd6a9ae3b6603deda294fcc21347597b Mon Sep 17 00:00:00 2001 From: patchthecode Date: Sat, 30 Sep 2023 11:08:24 -0400 Subject: [PATCH 077/109] https://github.com/patchthecode/JTAppleCalendar/issues/1378 --- .../JTACMonthActionFunctions.swift | 76 +++++++++++-------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift b/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift index 68010f8e..2e3b18c8 100644 --- a/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift +++ b/Sources/JTAppleCalendar/JTACMonthActionFunctions.swift @@ -121,46 +121,56 @@ extension JTACMonthView { } } - func setupMonthInfoDataForStartAndEndDate(with config: ConfigurationParameters? = nil) -> CalendarData { + func setupMonthInfoDataForStartAndEndDate(with optionalConfig: ConfigurationParameters? = nil) -> CalendarData { var months = [Month]() var monthMap = [Int: Int]() var totalSections = 0 var totalDays = 0 - var validConfig = config - if validConfig == nil { validConfig = calendarDataSource?.configureCalendar(self) } - if let validConfig = validConfig { - let comparison = validConfig.calendar.compare(validConfig.startDate, to: validConfig.endDate, toGranularity: .nanosecond) - if comparison == ComparisonResult.orderedDescending { - assert(false, "Error, your start date cannot be greater than your end date\n") - return (CalendarData(months: [], totalSections: 0, sectionToMonthMap: [:], totalDays: 0)) - } - - // Set the new cache - _cachedConfiguration = validConfig + + // first use the config passed in + // If nil, fetch the config from the datasource + let possibleConfig = optionalConfig ?? calendarDataSource?.configureCalendar(self) + + let validConfig: ConfigurationParameters + if let valid = possibleConfig { + validConfig = valid + } else { + assert(false, "Using default parameters. Your config should not have been nil here. In production, your dates will be an incorrect default date") + validConfig = ConfigurationParameters(startDate: Date(), endDate: Date()) + } + + let comparison = validConfig.calendar.compare(validConfig.startDate, to: validConfig.endDate, toGranularity: .nanosecond) + if comparison == ComparisonResult.orderedDescending { + assert(false, "Error, your start date cannot be greater than your end date\n") + return (CalendarData(months: [], totalSections: 0, sectionToMonthMap: [:], totalDays: 0)) + } + + // Set the new cache + _cachedConfiguration = validConfig + + if let + startMonth = calendar.startOfMonth(for: validConfig.startDate), + let endMonth = calendar.endOfMonth(for: validConfig.endDate) { + startOfMonthCache = startMonth + endOfMonthCache = endMonth + // Create the parameters for the date format generator + let parameters = ConfigurationParameters(startDate: startOfMonthCache, + endDate: endOfMonthCache, + numberOfRows: validConfig.numberOfRows, + calendar: calendar, + generateInDates: validConfig.generateInDates, + generateOutDates: validConfig.generateOutDates, + firstDayOfWeek: validConfig.firstDayOfWeek, + hasStrictBoundaries: validConfig.hasStrictBoundaries) - if let - startMonth = calendar.startOfMonth(for: validConfig.startDate), - let endMonth = calendar.endOfMonth(for: validConfig.endDate) { - startOfMonthCache = startMonth - endOfMonthCache = endMonth - // Create the parameters for the date format generator - let parameters = ConfigurationParameters(startDate: startOfMonthCache, - endDate: endOfMonthCache, - numberOfRows: validConfig.numberOfRows, - calendar: calendar, - generateInDates: validConfig.generateInDates, - generateOutDates: validConfig.generateOutDates, - firstDayOfWeek: validConfig.firstDayOfWeek, - hasStrictBoundaries: validConfig.hasStrictBoundaries) - - let generatedData = dateGenerator.setupMonthInfoDataForStartAndEndDate(parameters) - months = generatedData.months - monthMap = generatedData.monthMap - totalSections = generatedData.totalSections - totalDays = generatedData.totalDays - } + let generatedData = dateGenerator.setupMonthInfoDataForStartAndEndDate(parameters) + months = generatedData.months + monthMap = generatedData.monthMap + totalSections = generatedData.totalSections + totalDays = generatedData.totalDays } + let data = CalendarData(months: months, totalSections: totalSections, sectionToMonthMap: monthMap, totalDays: totalDays) return data } From 474aff4632508bf74b892c5d4777dd8df69dc1ba Mon Sep 17 00:00:00 2001 From: PatchTheCode Date: Mon, 2 Oct 2023 10:36:14 -0400 Subject: [PATCH 078/109] Update ISSUE_TEMPLATE --- .github/ISSUE_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE index 9bd725a1..ea0906e2 100644 --- a/.github/ISSUE_TEMPLATE +++ b/.github/ISSUE_TEMPLATE @@ -1,5 +1,5 @@ From abf4cfccc62ef75a070d0dded0fd823d5a86f72a Mon Sep 17 00:00:00 2001 From: jeron_thomas Date: Tue, 3 Oct 2023 18:21:03 -0400 Subject: [PATCH 079/109] 1. Ensure endDate is greater than start date 2. Added alert for user on dev mode to know if wrong datasource and delegate have been set --- SampleJTAppleCalendar/Main.storyboard | 175 +++++++++--------- .../JTACMonthActionFunctions.swift | 2 +- Sources/JTAppleCalendar/JTACVariables.swift | 14 +- 3 files changed, 101 insertions(+), 90 deletions(-) diff --git a/SampleJTAppleCalendar/Main.storyboard b/SampleJTAppleCalendar/Main.storyboard index 2c0eb425..5ea2a0af 100644 --- a/SampleJTAppleCalendar/Main.storyboard +++ b/SampleJTAppleCalendar/Main.storyboard @@ -1,12 +1,13 @@ - + - + + - + @@ -19,9 +20,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -