CalendarModel

public class CalendarModel

The date model of the calendar.

  • The calendar style. The default is .month.

    Declaration

    Swift

    public var calendarStyle: CalendarStyle { get set }
  • The first day of the week for the calendar, default confirms system setting. The weekday units are one-based. For Gregorian and ISO 8601 calendars, 1 is Sunday, 2 is Monday, 3 is Tuesday, 4 is Wednesday, 5 is Thursday, 6 is Friday and 7 is Saturday.

    Declaration

    Swift

    public var firstWeekday: Int { get set }
  • The selected date in the calendar, used to single select, when the style is .month, .fullScreenMonth, .week or .expandable.

    Declaration

    Swift

    public var selectedDate: Date? { get set }
  • The selected dates in the calendar, used to multi select, when the style is .datesSelection.

    Declaration

    Swift

    public var selectedDates: Set<Date>? { get set }
  • The selected range in the calendar, used to range select, when the style is .rangeSelection.

    Declaration

    Swift

    public var selectedRange: ClosedRange<Date>? { get set }
  • The disabled dates. Default is nil, which means all in month displayed dates are selectable.

    Declaration

    Swift

    public var disabledDates: CalendarDisabledDates? { get set }
  • The property is used to scroll to customize date. Developer can use this property to display whatever date in the available date range.

    Declaration

    Swift

    public var scrollToDate: Date { get set }
  • Public initializer for CalendarModel.

    Declaration

    Swift

    public init(calendarStyle: CalendarStyle = .month, startDate: Date? = nil, endDate: Date? = nil, displayDateAtStartup: Date? = nil, selectedDate: Date? = nil, selectedDates: Set<Date>? = nil, selectedRange: ClosedRange<Date>? = nil, disabledDates: CalendarDisabledDates? = nil, isPersistentSelection: Bool = false, scrollToDate: Date? = nil, firstWeekday: Int? = nil, showsMonthHeader: Bool? = nil, expandableStyleInWeekMode: Bool = false)

    Parameters

    calendarStyle

    The calendar style. The default is .month.

    startDate

    The start date of the calendar. Default is current year’s first day.

    endDate

    The end date of the calendar. Default is next year’s last day.

    displayDateAtStartup

    The display date at startup.

    selectedDate

    The selected date in the calendar, used to single select, when the style is .month, .fullScreenMonth, .week or .expandable.

    selectedDates

    The selected dates in the calendar, used to multi select, when the style is .datesSelection.

    selectedRange

    The selected range in the calendar, used to range select, when the style is .rangeSelection.

    disabledDates

    The disabled dates. Default is nil, which means all in month displayed dates are selectable.

    isPersistentSelection

    Boolean indicates whether or not a selected date stays selected when the user scrolls away to another set of dates. The default is false.

    scrollToDate

    The property is used to scroll to customize date. Developer can use this property to display whatever date in the available date range.

    firstWeekday

    The first day of the week for the calendar, default confirms system setting. The weekday units are one-based. For Gregorian and ISO 8601 calendars, 1 is Sunday, 2 is Monday, 3 is Tuesday, 4 is Wednesday, 5 is Thursday, 6 is Friday and 7 is Saturday.

    showsMonthHeader

    This property indicates whether the month header should display.

    expandableStyleInWeekMode

    This property indicates whether the expandable style in week mode first. Default is false. Only available when style is .expandable.