func calendar(_ calendar: JTAppleCalendarView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTAppleCollectionReusableView {
let header = calendar.dequeueReusableJTAppleSupplementaryView(withReuseIdentifier: "calendarHeader", for: indexPath) as!CalendarHeader
header.monthLabel.text = monthName
return header
}
I want to get the month name here to display it in Header so that month name can scroll with the calendar vertically. How should I get it? Thank you for helping me
let currentCalendar = Calendar.current
var monthFormatter = DateFormatter()
func calendar(_ calendar: JTAppleCalendarView,
headerViewForDateRange
range: (start: Date, end: Date),
at indexPath: IndexPath) -> JTAppleCollectionReusableView {
let date = range.start
let month = calendarCurrent.component(.month, from: date)
var monthName = monthFormatter.monthSymbols[month - 1]
let header = calendar.dequeueReusableJTAppleSupplementaryView(withReuseIdentifier: "calendarHeader", for: indexPath) as!CalendarHeader
header.monthLabel.text = monthName
return header
}
Hope you have found the solution to your problem. Thanks