CPCViewSelection

public enum CPCViewSelection : Equatable

A value that describes view selection mode and currently selected days simultaneously.

  • Selection is disabled.

    Declaration

    Swift

    case none
  • Single day selection mode; associated value holds currently selected day or nil if selection is empty.

    Declaration

    Swift

    case single(CPCDay?)
  • Range of dates selection mode; associated value holds currently selected days range (possibly empty).

    Declaration

    Swift

    case range(CountableRange<CPCDay>)
  • Arbitrary set of dates selection mode; associated value holds unordered collection of selected dates (possibly empty).

    Declaration

    Swift

    case unordered(Set<CPCDay>)
  • Arbitrary array of dates selection mode; associated value holds collection of selected dates (possibly empty) ordered the same way that user did pick them.

    Declaration

    Swift

    case ordered([CPCDay])
  • Check whether a day is selected given all selected days.

    Declaration

    Swift

    public func isDaySelected(_ day: CPCDay) -> Bool

    Parameters

    day

    The day to check for containment.

    Return Value

    true if given is contained in the selection; otherwise, false.

  • A Boolean value indicating whether the selection does not contain any day.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • Returns set of days contained by exactly one of given selection values.

    Declaration

    Swift

    public func difference(_ other: CPCViewSelection) -> Set<CPCDay>

    Parameters

    other

    Selection value to calculate difference from.

    Return Value

    Difference between selection values.

  • Returns a subset of this selection that contains days matching specified date constraints.

    Declaration

    Swift

    public func clamped<R>(to datesRange: R) -> CPCViewSelection where R : CPCDateInterval

    Parameters

    datesRange

    The limits to clamp this selection to.

  • Forms union of two values and stores the result in the left-hand-side variable.

    Declaration

    Swift

    public static func += (lhs: inout CPCViewSelection, rhs: CPCViewSelection)

    Parameters

    lhs

    The first value to unite.

    rhs

    The second value to unite.

  • Forms union of two values and returns it leaving original values unchanged.

    Declaration

    Swift

    public static func + (lhs: CPCViewSelection, rhs: CPCViewSelection) -> CPCViewSelection

    Parameters

    lhs

    The first value to unite.

    rhs

    The second value to unite.

  • Subtracts from the first value days that are selected byn the second one and stores the result in the left-hand-side variable.

    Declaration

    Swift

    public static func -= (lhs: inout CPCViewSelection, rhs: CPCViewSelection)

    Parameters

    lhs

    Selection value to subtract days from.

    rhs

    Value indicating days that should not be selected.

  • Calculates selection that contains all of the left-hand-side days except those contained in right-hand-side one and returns it leaving original unchanged.

    Declaration

    Swift

    public static func - (lhs: CPCViewSelection, rhs: CPCViewSelection) -> CPCViewSelection

    Parameters

    lhs

    Selection value to subtract days from.

    rhs

    Value indicating days that should not be selected.