fscalender weekscope swift

369 Views Asked by At

I'm using fscalender in my project, i have to customise the header title in weekscope.

This is my image

from above image weekdays showing is from may 16 - 22. I want to display it over the header title.

How to achieve this?

I'm new in iOS Thanks in advance

1

There are 1 best solutions below

0
Kishan Bhatiya On

One way, You can do it with customization like in the below method of FSCalendar and set week start and end date as follow and set custom header title:

fileprivate lazy var dateFormatter: DateFormatter = {
    let formatter = DateFormatter()
    formatter.dateFormat = "MMM d"
    return formatter
}()

func calendarCurrentPageDidChange(_ calendar: FSCalendar) {
   let weekStartDt = calendar.currentPage
   let weekEndDt = Calendar.current.date(byAdding: .day, value: 6, to: weekStartDt)!
   let weekName = "\(self.dateFormatter.string(from: weekStartDt)) - \(self.dateFormatter.string(from: weekEndDt))"
   self.yourHdrLbl.text = weekName
}