I am using FSCalendar and its displaying only default holidays like on Sunday (The weekend) and so I want to add my own holidays in it and change color. So please anyone knows how to add custom holidays????
Asked
Active
Viewed 564 times
1 Answers
1
I think you have to maintain holidays list on code level like model class(Array) or you can use the database for storing holidays list. At the render time only adopt the FSCalendarDelegateAppearance delegate. This call a delegate function for every date.
See example i think it can help you,
var datesWithHolidays = ["2018/09/03", "2018/10/06", "2018/09/12", "2018/10/25"]
//This is the delegate method
func calendar(_ calendar: FSCalendar, appearance: FSCalendarAppearance, fillDefaultColorFor date: Date) -> UIColor? {
let dateString = self.dateFormatter1.string(from: date)
if self.datesWithHolidays.contains(dateString) {
return UIColor.green
}
return nil
}

Sid Singh
- 53
- 7