Array

public extension Array where Element: RVS_CalendarInputDateItemProtocol

This extension allows you to filter an Array, and get some information about the contents.

Available where Element: RVS_CalendarInputDateItemProtocol

  • This returns the range of years. It uses the calendar system for the data.

    Declaration

    Swift

    var yearRange: Range<Int> { get }
  • This returns the range of months, in the given year. IT allows the user to specify a calendar to use for this.

    Declaration

    Swift

    func monthRange(for inYear: Int) -> Range<Int>

    Parameters

    for

    The year, as an integer. This needs to be in the calendar system used by the data.

    Return Value

    The integer range (1-based) of the months available in this year.

  • This returns the range of months, in the given year. It allows the user to specify a calendar to use for this.

    Declaration

    Swift

    func dayRange(year inYear: Int,
                  month inMonth: Int,
                  calendar inCalendar: Calendar? = Calendar.current) -> Range<Int>

    Parameters

    year

    The year, as an integer. This needs to be in the calendar system described by the calendar passed in (or current).

    month

    The month of the year, as an integer. This needs to be in the calendar system described by the calendar passed in (or current).

    calendar

    This is the calendar to use, for determining the month range. The year needs to be in this calendar system. It is optional. If not specified, the current calendar is used.

  • This returns a filtered array of the data, depending on the criteria provided. The criteria are all optional. If no criteria are provided, the entire array is returned. All responses are sorted from earliest date, to the latest date.

    Declaration

    Swift

    func allResults(forThisYear inYear: Int = 0,
                    forThisMonth inMonth: Int = 0,
                    forThisDayOfTheMonth inDay: Int = 0,
                    enabled inIsEnabled: Bool? = nil,
                    selected inIsSelected: Bool? = nil) -> [Element]

    Parameters

    forThisYear

    The year, as an integer. If not specified, then all years are returned.

    forThisMonth

    The month of the year, as an integer. If not specified, then all months are returned.

    forThisDayOfTheMonth

    The day of the month, as an integer. If not specified, then all days of the month are returned.

    enabled

    If true, then only items that are enabled will be returned. If false, the only items that are not enabled will be returned. Default is nil (all items returned, ignoring enabled status).

    selected

    If true, then only items that are selected will be returned. If false, the only items that are not selected will be returned. Default is nil (all items returned, ignoring selected status).