FSCalendar event dot disappears after selecting the day

401 Views Asked by At

I am using this code to add dots for events and the dots appear perfectly fine but when I select the day with the event, the dot permanently disappears and even when selecting another day, the dot still doesnt reappear. here is my code to make the dots appear at the start

 func calendar(_ calendar: FSCalendar, willDisplay cell: FSCalendarCell, for date: Date, at monthPosition: FSCalendarMonthPosition) {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "yyyy-MM-dd"
    let dateString = dateFormatter.string(from: date)

    cell.eventIndicator.isHidden = false

    for wp in worriesPanic{
        let wPDateStr = dateFormatter.string(from: wp.date!)
        if wPDateStr == dateString {
            cell.eventIndicator.numberOfEvents = 1
            break
        }
    }
}
1

There are 1 best solutions below

0
On
You can use image method for show event.

   func calendar(_ calendar: FSCalendar, imageFor date: Date) -> UIImage? {
        let dateString = self.dateFormatter1.string(from: date)
        if self.yourDate.contains(dateString) {
            return  UIImage(named:"img")
        }
        return  nil
    }