Skip to content

Commit

Permalink
Merge pull request #324 from phuanggh/feat_headerTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
kvyatkovskys authored Aug 29, 2023
2 parents eb6ca2c + 315ceb6 commit 5c4d8e6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/KVKCalendar/MonthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ final class MonthView: UIView {
headerViewFrame = customHeaderView.frame
addSubview(customHeaderView)
} else {
setHeaderTitle(date)
setHeaderTitleAndNotify(date)
}
}

Expand Down Expand Up @@ -171,7 +171,7 @@ final class MonthView: UIView {
return newMoveDate
}

private func setHeaderTitle(_ date: Date) {
private func setHeaderTitleAndNotify(_ date: Date) {
weekHeaderView.date = date
delegate?.didDisplayHeaderTitle(date, style: style, type: .month)
}
Expand Down Expand Up @@ -413,7 +413,7 @@ extension MonthView: UICollectionViewDelegate, UICollectionViewDelegateFlowLayou
guard let index = objectView.indexPathForItem(at: center) else { return }

let month = parameters.monthData.data.months[index.section]
setHeaderTitle(month.date)
weekHeaderView.date = month.date
}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
Expand All @@ -423,6 +423,7 @@ extension MonthView: UICollectionViewDelegate, UICollectionViewDelegateFlowLayou
guard let index = objectView.indexPathForItem(at: center) else { return }

let month = parameters.monthData.data.months[index.section]
setHeaderTitleAndNotify(month.date)
guard style.month.autoSelectionDateWhenScrolling else { return }
let newDate = parameters.monthData.findNextDateInMonth(month)
guard parameters.monthData.date != newDate else { return }
Expand All @@ -446,7 +447,7 @@ extension MonthView: UICollectionViewDelegate, UICollectionViewDelegateFlowLayou
}

let month = parameters.monthData.data.months[visibleIndex]
setHeaderTitle(month.date)
setHeaderTitleAndNotify(month.date)
guard style.month.autoSelectionDateWhenScrolling else { return }
let newDate = parameters.monthData.findNextDateInMonth(month)
guard parameters.monthData.date != newDate else { return }
Expand Down

0 comments on commit 5c4d8e6

Please sign in to comment.