CPCCalendarUnitBackingType
internal protocol CPCCalendarUnitBackingType : Hashable
Common protocol for types that are suitable as backing storage of CPCCalendarUnit instances.
-
Type for which this one serves as a backing storage.
Declaration
Swift
associatedtype BackedType : CPCCalendarUnit -
init(containing:calendar:)Default implementationCreates a new storage for a calendar unit that contains a specific date.
Default Implementation
Declaration
Swift
init(containing date: Date, calendar: Calendar)Parameters
dateThe date that should be contained in the backed calendar unit.
calendarCalendar to perform calculations with.
-
startDate(using:)Default implementationGet an earliest date that is contained in a backed calendar unit.
Default Implementation
Declaration
Swift
func startDate(using calendar: Calendar) -> DateParameters
calendarCalendar to perform calculations with.
Return Value
Earliest date of the represented calendar unit.
-
distance(to:using:)Default implementationCalculate distance between this value and other one, measured in the unit’s durations.
Default Implementation
Declaration
Swift
func distance(to other: Self, using calendar: Calendar) -> IntParameters
otherAn instance of backing value to calculate distance to.
calendarCalendar to perform calculations with.
Return Value
Number of represented calendar units between starts of corresponding date intervals.
-
advanced(by:using:)Default implementationCalculate a backing value with specific distance from represented one.
Default Implementation
Declaration
Swift
func advanced(by value: Int, using calendar: Calendar) -> SelfParameters
valueDistance from this value.
calendarCalendar to perform calculations with.
Return Value
Instance of backing value for which represented unit’s
startdate is advanced byvalueunit durations.
View on GitHub
Install in Dash
CPCCalendarUnitBackingType Protocol Reference