From 76219f93bf5a6262e706962ea6d50f933e45e7ce Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Fri, 22 May 2020 20:56:39 +0300 Subject: [PATCH 1/9] first commit podSpec updated --- JTAppleCalendar.podspec | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/JTAppleCalendar.podspec b/JTAppleCalendar.podspec index 1cb6da5c..3834a9d6 100644 --- a/JTAppleCalendar.podspec +++ b/JTAppleCalendar.podspec @@ -1,16 +1,16 @@ Pod::Spec.new do |s| - s.name = "JTAppleCalendar" - s.version = "8.0.3" + s.name = "JTAppleCalendarGreenRoad" + s.version = "1.0.0" 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. DESC - s.homepage = "https://patchthecode.com" + s.homepage = "https://github.com/alexvaiman/" # s.screenshots = "https://patchthecode.github.io/" s.license = 'MIT' s.author = { "JayT" => "patchthecode@gmail.com" } - s.source = { :git => "https://github.com/patchthecode/JTAppleCalendar.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/alexvaiman/JTAppleCalendar.git", :tag => s.version.to_s } s.swift_version = '5' @@ -18,5 +18,4 @@ A highly configurable Apple calendar control. Contains features like boundary da s.tvos.deployment_target = '10.0' s.source_files = 'Sources/JTAppleCalendar/*.swift' -end - +end \ No newline at end of file From 3e64d5923481a86af8e340b90d80707c906c1bd5 Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Fri, 22 May 2020 20:58:55 +0300 Subject: [PATCH 2/9] cellStatus bug fixed --- .../JTACInteractionMonthFunctions.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 43a1cf31..633e2e7b 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -104,11 +104,14 @@ extension JTACMonthView { /// - returns: /// - CellState: The state of the found cell public func cellStatus(at point: CGPoint) -> CellState? { - if let indexPath = indexPathForItem(at: point) { - let cell = cellForItem(at: indexPath) as? JTACDayCell - return cellStateFromIndexPath(indexPath, cell: cell) + guard let indexPath = indexPathForItem(at: point) else { + return nil } - return nil + + let i = indexPath.item + let row = i / maxNumberOfDaysInWeek + let col = i % maxNumberOfDaysInWeek + return cellStatusForDate(at: row, column: col) } /// Deselect all selected dates From 36645ddc9eb0f8d2471dad0c9603f316e39c9cfa Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 04:21:02 +0300 Subject: [PATCH 3/9] triggerScrollToDateDelegate in calendar.scrollToDate now triggers willScrollToDateSegmentWith delegate function --- Sources/JTAppleCalendar/JTACMonthViewProtocols.swift | 4 ++++ Sources/JTAppleCalendar/JTACScrollViewDelegates.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift b/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift index d65df022..f3b40d3a 100644 --- a/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift +++ b/Sources/JTAppleCalendar/JTACMonthViewProtocols.swift @@ -138,6 +138,9 @@ public protocol JTACMonthViewDelegate: class { /// Informs the delegate that the user just lifted their finger from swiping the calendar func scrollDidEndDecelerating(for calendar: JTACMonthView) + /// Informs the delegate that the scrolling animation concludes + func scrollDidEndScrollingAnimation(for calendar: JTACMonthView) + /// Tells the delegate that a scroll occured func calendarDidScroll(_ calendar: JTACMonthView) @@ -178,4 +181,5 @@ public extension JTACMonthViewDelegate { func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize? { return nil } func sizeOfDecorationView(indexPath: IndexPath) -> CGRect { return .zero } func scrollDidEndDecelerating(for calendar: JTACMonthView) {} + func scrollDidEndScrollingAnimation(for calendar: JTACMonthView) {} } diff --git a/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift b/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift index ec2d7290..77f50568 100644 --- a/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift +++ b/Sources/JTAppleCalendar/JTACScrollViewDelegates.swift @@ -197,6 +197,7 @@ extension JTACMonthView: UIScrollViewDelegate { DispatchQueue.main.async { // https://github.com/patchthecode/JTAppleCalendar/issues/778 self.executeDelayedTasks(.scroll) + self.calendarDelegate?.scrollDidEndScrollingAnimation(for: self) } } From 0311d9dc3540bd91648a9584e72d377acecbd1c9 Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 13:19:58 +0300 Subject: [PATCH 4/9] cellstatus.cell is now returning correct cell --- .../JTACInteractionMonthFunctions.swift | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 633e2e7b..19d5ff0c 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -103,15 +103,28 @@ extension JTACMonthView { /// - Parameter: point of the cell you want to find /// - returns: /// - CellState: The state of the found cell - public func cellStatus(at point: CGPoint) -> CellState? { + public func cellStatus(at point: CGPoint) -> CellState? { guard let indexPath = indexPathForItem(at: point) else { return nil } + guard let section = currentSection() else { + return nil + } + let i = indexPath.item let row = i / maxNumberOfDaysInWeek - let col = i % maxNumberOfDaysInWeek - return cellStatusForDate(at: row, column: col) + let column = i % maxNumberOfDaysInWeek + let convertedRow = (row * maxNumberOfDaysInWeek) + column + let indexPathToFind = IndexPath(item: convertedRow, section: section) + + if let date = dateOwnerInfoFromPath(indexPathToFind) { + let cell = cellForItem(at: indexPathToFind) as? JTACDayCell + let stateOfCell = cellStateFromIndexPath(indexPathToFind, withDateInfo: date,cell: cell) + return stateOfCell + } + + return nil } /// Deselect all selected dates From 6e88a0105e2ddae14dfbf16a35d7daf681ca0087 Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 13:52:46 +0300 Subject: [PATCH 5/9] cellStatusForDate(at point: CGPoint) func added --- .../JTACInteractionMonthFunctions.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 19d5ff0c..64772945 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -26,6 +26,21 @@ import UIKit extension JTACMonthView { + /// Returns the cellStatus of a date that is visible on the screen. + /// If the row and column for the date cannot be found, + /// then nil is returned + /// Parameter: point of the cell you want to find + /// - Paramater column: Int column of the date to find + /// - returns: + /// - CellState: The state of the found cell + public func cellStatusForDate(at point: CGPoint) -> CellState? { + guard let indexPath = indexPathForItem(at: point) else { + return nil + } + + return cellStatusForDate(at: indexPath.item / maxNumberOfDaysInWeek , column: indexPath.item % maxNumberOfDaysInWeek) + } + /// Returns the cellStatus of a date that is visible on the screen. /// If the row and column for the date cannot be found, /// then nil is returned From 22dd7c7cf1bf28532a39be228bbedacb471c11e2 Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 13:53:42 +0300 Subject: [PATCH 6/9] style --- Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 64772945..392e3a2c 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -118,7 +118,7 @@ extension JTACMonthView { /// - Parameter: point of the cell you want to find /// - returns: /// - CellState: The state of the found cell - public func cellStatus(at point: CGPoint) -> CellState? { + public func cellStatus(at point: CGPoint) -> CellState? { guard let indexPath = indexPathForItem(at: point) else { return nil } @@ -126,7 +126,7 @@ extension JTACMonthView { guard let section = currentSection() else { return nil } - + let i = indexPath.item let row = i / maxNumberOfDaysInWeek let column = i % maxNumberOfDaysInWeek From d38e2d91047b2eac42e1d3da388b020b988cf6b3 Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 14:16:45 +0300 Subject: [PATCH 7/9] function documination fixed --- Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 392e3a2c..a411505e 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -30,7 +30,6 @@ extension JTACMonthView { /// If the row and column for the date cannot be found, /// then nil is returned /// Parameter: point of the cell you want to find - /// - Paramater column: Int column of the date to find /// - returns: /// - CellState: The state of the found cell public func cellStatusForDate(at point: CGPoint) -> CellState? { From dcfe58193b38ea590c28f092692e85e97de64f8c Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 14:20:24 +0300 Subject: [PATCH 8/9] function documination fixed --- 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 a411505e..0c5f0ba0 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -27,7 +27,7 @@ import UIKit extension JTACMonthView { /// Returns the cellStatus of a date that is visible on the screen. - /// If the row and column for the date cannot be found, + /// If the point does not correspond to existing indexPath cell, /// then nil is returned /// Parameter: point of the cell you want to find /// - returns: From 0f8e731c3e2acb2d2966304aa1bc433f23fc25cd Mon Sep 17 00:00:00 2001 From: Alex Vaiman Date: Sat, 23 May 2020 14:25:02 +0300 Subject: [PATCH 9/9] function documentation fixed --- .../JTAppleCalendar/JTACInteractionMonthFunctions.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift index 64772945..0c5f0ba0 100644 --- a/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift +++ b/Sources/JTAppleCalendar/JTACInteractionMonthFunctions.swift @@ -27,10 +27,9 @@ import UIKit extension JTACMonthView { /// Returns the cellStatus of a date that is visible on the screen. - /// If the row and column for the date cannot be found, + /// If the point does not correspond to existing indexPath cell, /// then nil is returned /// Parameter: point of the cell you want to find - /// - Paramater column: Int column of the date to find /// - returns: /// - CellState: The state of the found cell public func cellStatusForDate(at point: CGPoint) -> CellState? { @@ -118,7 +117,7 @@ extension JTACMonthView { /// - Parameter: point of the cell you want to find /// - returns: /// - CellState: The state of the found cell - public func cellStatus(at point: CGPoint) -> CellState? { + public func cellStatus(at point: CGPoint) -> CellState? { guard let indexPath = indexPathForItem(at: point) else { return nil } @@ -126,7 +125,7 @@ extension JTACMonthView { guard let section = currentSection() else { return nil } - + let i = indexPath.item let row = i / maxNumberOfDaysInWeek let column = i % maxNumberOfDaysInWeek