TemporalUnit

@available(*, deprecated, message: "This protocol will be removed in the future.")
public protocol TemporalUnit

Defines a common format for a TemporalSpec unit used in operations. It is a tuple of Calendar.Component, such as .year, and an integer value. Those two are later used in date operations such “4 hours from now” and “2 months ago”.

  • The Calendar.Component (e.g. .year, .hour)

    Declaration

    Swift

    var component: Calendar.Component { get }
  • The integer value. Must be a valid value for the given component

    Declaration

    Swift

    var value: Int { get }