0

I'm using FSCalendar in my app and I would like to add some events to my calendar by instead of small dots (the default way for marking event) I would like to mark the day with an event as big colour circle (the same way as e.g. the current day is marked in FSCalendar).

So basically my question is : How can I change background colour of any given day ?

Below you can see I picture which I found on https://github.com/WenchaoD/FSCalendar You can see many colours on the calendar so I assume it is possible to mark the day as I want but also I couldn't find right property or function to provide this output.

big colour circle on calendar

thanks for your time and help !

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
wojtek
  • 75
  • 1
  • 1
  • 8

1 Answers1

3

Try to add the following:

  1. Add a delegate FSCalendarDelegateAppearance

  2. Use method fillDefaultColorFor

    func calendar(_ calendar: FSCalendar, appearance: FSCalendarAppearance, fillDefaultColorFor date: Date) -> UIColor? {
    
     //format date according your need
    
     let calendarDateString = date.stringFromLocal(Format: "MM/dd/yyyy") 
    
     //your events date array
    
     if dateOfEvents.contains(calendarDateString) {
    
         return UIColor.blue
    
     }
    
     return nil //add your color for default 
    
    }
    
Kishan Bhatiya
  • 2,175
  • 8
  • 14
  • 1
    yup, that will do it, thank you. maybe a better idea would be returning nil as default because when I used UIColor.clear the current day on calendar was "invisible" – wojtek Nov 10 '20 at 18:45