-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
triggerScrollToDateDelegate in calendar.scrollToDate now triggers willScrollToDateSegmentWith delegate function #1264
base: master
Are you sure you want to change the base?
Changes from all commits
8263410
9c3472e
d2d4ee0
a1ad992
4a730dc
a79b7af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,7 +356,7 @@ | |
CLANG_ENABLE_MODULES = YES; | ||
CODE_SIGN_STYLE = Automatic; | ||
DEFINES_MODULE = YES; | ||
DEVELOPMENT_TEAM = GBBYECNDQ9; | ||
DEVELOPMENT_TEAM = D35B5Y6JX8; | ||
DYLIB_COMPATIBILITY_VERSION = 1; | ||
DYLIB_CURRENT_VERSION = 1; | ||
DYLIB_INSTALL_NAME_BASE = "@rpath"; | ||
|
@@ -384,7 +384,7 @@ | |
CLANG_ENABLE_MODULES = YES; | ||
CODE_SIGN_STYLE = Automatic; | ||
DEFINES_MODULE = YES; | ||
DEVELOPMENT_TEAM = GBBYECNDQ9; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't need |
||
DEVELOPMENT_TEAM = D35B5Y6JX8; | ||
DYLIB_COMPATIBILITY_VERSION = 1; | ||
DYLIB_CURRENT_VERSION = 1; | ||
DYLIB_INSTALL_NAME_BASE = "@rpath"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -536,8 +536,8 @@ extension JTACMonthView { | |
|
||
// Set triggereing of delegate on scroll | ||
self.triggerScrollToDateDelegate = triggerScrollToDateDelegate | ||
// Ensure date is within valid boundary | ||
|
||
// Ensure date is within valid boundary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't need extra tabulation |
||
let components = calendar.dateComponents([.year, .month, .day], from: date) | ||
let firstDayOfDate = calendar.date(from: components)! | ||
if !((firstDayOfDate >= startOfMonthCache!) && (firstDayOfDate <= endOfMonthCache!)) { return } | ||
|
@@ -551,7 +551,12 @@ extension JTACMonthView { | |
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 self.triggerScrollToDateDelegate == true { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't need extra tabulation |
||
let dateSegmentInfo = datesAtCurrentOffset(point) | ||
self.scrollViewWillBeginDragging(self, visibleDates: dateSegmentInfo) | ||
} | ||
|
||
scrollTo(point: point, | ||
triggerScrollToDateDelegate: triggerScrollToDateDelegate, | ||
isAnimationEnabled: animateScroll, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't need extra tabulation |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,10 @@ extension JTACMonthView: UIScrollViewDelegate { | |
DispatchQueue.main.async { // https://github.com/patchthecode/JTAppleCalendar/issues/778 | ||
self.executeDelayedTasks(.scroll) | ||
} | ||
|
||
DispatchQueue.main.async { | ||
self.calendarDelegate?.scrollDidEndScrollingAnimation(for: self) | ||
} | ||
} | ||
|
||
/// Tells the delegate that the scroll view has | ||
|
@@ -207,8 +211,16 @@ extension JTACMonthView: UIScrollViewDelegate { | |
self.calendarDelegate?.calendar(self, didScrollToDateSegmentWith: dates) | ||
} | ||
} | ||
|
||
/// Tells the delegate that a scroll occured | ||
|
||
/// Tells the delegate when a scrolling animaton | ||
/// in the scroll view begins | ||
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView, visibleDates: DateSegmentInfo) { | ||
if let shouldTrigger = triggerScrollToDateDelegate, shouldTrigger == true { | ||
self.calendarDelegate?.calendar(self, willScrollToDateSegmentWith: visibleDates) | ||
} | ||
} | ||
|
||
/// Tells the delegate that a scroll occured | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't need extra tabulation |
||
public func scrollViewDidScroll(_ scrollView: UIScrollView) { | ||
calendarDelegate?.calendarDidScroll(self) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need