Skip to content

Commit

Permalink
Fix - In calendar is not yet loaded but user calls reload data, save …
Browse files Browse the repository at this point in the history
…the closure to delayed
  • Loading branch information
patchthecode committed Nov 2, 2016
1 parent 11255d3 commit da0a0ad
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Sources/UserInteractionFunctions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ extension JTAppleCalendarView {
animation: Bool = false,
completionHandler: (() -> Void)? = nil) {
if !calendarIsAlreadyLoaded {
if let validCompletionHandler = completionHandler {
delayedExecutionClosure.append(validCompletionHandler)
}
return
}
reloadData(checkDelegateDataSource: true,
Expand Down Expand Up @@ -502,12 +505,11 @@ extension JTAppleCalendarView {
/// number for a vertical scrolling calendar
/// - Parameter completionHandler: A completion handler that will be
/// executed at the end of the scroll animation
public func scrollToDate(
_ date: Date,
triggerScrollToDateDelegate: Bool = true,
animateScroll: Bool = true,
preferredScrollPosition: UICollectionViewScrollPosition? = nil,
completionHandler: (() -> Void)? = nil) {
public func scrollToDate(_ date: Date,
triggerScrollToDateDelegate: Bool = true,
animateScroll: Bool = true,
preferredScrollPosition: UICollectionViewScrollPosition? = nil,
completionHandler: (() -> Void)? = nil) {
if !calendarIsAlreadyLoaded {
delayedExecutionClosure.append {
self.scrollToDate(
Expand Down

0 comments on commit da0a0ad

Please sign in to comment.