UnitDuration
class UnitDuration : Dimension, NSSecureCoding
-
Returns a date components formatter set up for displaying duration values.
Declaration
Swift
public static func defaultFormatter(for units: Set<UnitDuration>, baseUnit: UnitDuration? = nil) -> RSDDurationFormatter
Parameters
units
The units of the formatter.
Return Value
A date components formatter set up to display a duration.
-
The calendar component that maps to this unit.
Declaration
Swift
public var calendarComponent: Calendar.Component { get }
-
The maximum value represented by this unit.
Declaration
Swift
public func maxTimeValue() -> Int
-
Calculate the set of units that are a valid subset of the display units used in a picker for entering time intervals where
self
is the base unit.If the
max
duration isnil
, then this function will return the units that are greater than or equal toself
. Otherwise, the subset will only include those units that are less than the max interval. For example, if the maximum interval is 30 minutes, then the.hour
unit is not included.Declaration
Swift
public func defaultUnits(with max: Measurement<UnitDuration>? = nil) -> Set<UnitDuration>
Parameters
max
The duration that defines the maximum valid interval.
-
Increment up to the next larger unit.
Declaration
Swift
public func increment() -> UnitDuration?
-
The set of all the units.
Declaration
Swift
public static var all: Set<UnitDuration> { get }
-
Compariable implementation.
Declaration
Swift
public static func < (lhs: UnitDuration, rhs: UnitDuration) -> Bool