Search code examples
iosswiftfscalendar

FSCalendar function called when month changed


I have been using https://github.com/WenchaoD/FSCalendar recently for a project.

One thing I have been trying to do is call a function whenever the calendar changes months (for example, if the user swipes right or left). However, I can't seem to find any functions that are called when the month on FSCalendar changes.

I tried to override:

func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {

But that doesn't seem to work. Maybe I missed something in the documentation. Is there a way to see when the months changes in the FSCalendar package?


Solution

  • 5 seconds after posting this, I found

    func calendarCurrentPageDidChange(_ calendar: FSCalendar) {
        print("changed")
    }
    

    That solved my problem.