Search code examples
swift3fscalendar

Swift 3 FSCalendar select all dates by default


I am able to select certain dates while loading the FSCalendar. But I want to load calendar with all dates selected.

var attendance_list = [NSManagedObject]();
//After loading data
for attendanceObj in attendance_list{

            let createdDate =   attendanceObj.value(forKey: "date") as! String;
            self.calendar.select(Utils.convertStringToDate(createdDate)) 
}

Above code is for selecting dates from an array.
How can I select all dates without any array ?


Solution

  • I wouldn't recommend selecting all dates since the beginning of time to the end of the foreseeable future (also, you cannot do it without an array). What I would recommend is getting the beginingOfMonth and endOfMonth (both methods are available) in currentPageDidChange (another available method). Then set the dates between these two dates to selected inside a loop.