CPCCalendarUnit

internal protocol CPCCalendarUnit : CPCCalendarUnitBase

Common protocol implementing most of CPCDay, CPCWeek, CPCMonth and CPCYear functionality.

  • CommonCacheKey Extension method

    See CPCCommonCalendarUnitCackeKey.

    Declaration

    Swift

    internal typealias CommonCacheKey = CPCCommonCalendarUnitCacheKey
  • cachedDistance(to:) Extension method

    Query calendar units cache for distance between two units.

    Declaration

    Swift

    internal func cachedDistance(to other: Self) -> Stride?

    Parameters

    other

    Calendar unit to fetch distance to.

    Return Value

    Distance from this unit to other or nil if no such value was previously cached.

  • cacheDistance(_:to:) Extension method

    Cache a distance between two calendar units.

    Declaration

    Swift

    internal func cacheDistance(_ distance: Stride, to other: Self)

    Parameters

    distance

    Distance between this unit and other that is being cached.

    other

    Unit, distance to which is being cached.

  • cachedAdvancedUnit(by:) Extension method

    Query calendar units cache for a unit that has specific distance from this one.

    Declaration

    Swift

    internal func cachedAdvancedUnit(by stride: Self.Stride) -> Self?

    Parameters

    stride

    Required distance between units.

    Return Value

    Unit that has requested distance from this one or nil if no such value was previously cached.

  • Cache a calendar unit that has specific distance from this one.

    Declaration

    Swift

    internal func cacheUnitValue(_ value: Self, advancedBy distance: Stride)

    Parameters

    value

    Calendar unit that is being cached.

    distance

    Distance to the unit that is being cached.

  • Cache a caclendar unit as a frequently used one for the specified key.

    Declaration

    Swift

    internal static func cachedCommonUnit(for key: CommonCacheKey, calendar: CPCCalendarWrapper) -> Self

    Parameters

    key

    Type of the unit cached.