RSDDurationRangeObject
public struct RSDDurationRangeObject : RSDDurationRange, RSDRangeWithFormatter, Codable
RSDDurationRangeObject
extends the properties of an RSDInputField
for a .duration
data type.
-
The minimum allowed duration.
Declaration
Swift
public let minimumDuration: Measurement<UnitDuration>
-
The maximum allowed duration. When the value of this property is
nil
, there is no maximum.Declaration
Swift
public let maximumDuration: Measurement<UnitDuration>?
-
A step interval to be used for a slider or picker in the smallest units represented.
Declaration
Swift
public let stepInterval: Int?
-
The duration units that should be included in the formatter and picker used for setting up a
.duration
data type.Declaration
Swift
public let durationUnits: Set<UnitDuration>
-
Formatter
that is appropriate to the data type. For a duration, the formatter is aDateComponentsFormatter
.Declaration
Swift
public var formatter: Formatter?
-
Default initializer for a
Decimal
range. This is used to initialize the range for aDecimal
type.Declaration
Swift
public init(durationUnits: Set<UnitDuration>? = nil, minimumDuration: Measurement<UnitDuration>? = nil, maximumDuration: Measurement<UnitDuration>? = nil, stepInterval: Int? = nil)
Parameters
durationUnits
The units that should be included in the formatter and picker. If
nil
then the the default will include all units.minimumDuration
The minimum allowed duration. If
nil
then the default will be0
.maximumDuration
The maximum allowed duration.
stepInterval
A step interval to be used for a slider or picker in the smallest units represented.
-
Initialize from a
Decoder
.- example:
{ "minimumValue" : 15, "maximumValue" : 360, "stepInterval" : 5, "unit" : "min", "durationUnits" : ["min", "hr"] }
Throws
DecodingError
Declaration
Swift
public init(from decoder: Decoder) throws
Parameters
decoder
The decoder to use to decode this instance.
-
Encode the object to the given encoder.
Throws
EncodingError
Declaration
Swift
public func encode(to encoder: Encoder) throws
Parameters
encoder
The encoder to use to encode this instance.