JTAppleCalendar iOS 获取 header 中的月份以随日历滚动

JTAppleCalendar iOS get month in header to scroll it with calendar

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
    }

我想在此处获取月份名称以显示在 Header 中,以便月份名称可以随日历垂直滚动。我应该怎么得到它? 谢谢你帮助我

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

    }

希望您已找到问题的解决方案。谢谢