Structure
Duration.UnitsFormatStyle.FractionalPartDisplayStrategy
iOS 16.0+
iPadOS 16.0+
Mac Catalyst 16.0+
macOS 13.0+
tvOS 16.0+
watchOS 9.0+
Specifies how a duration is displayed if it cannot be represented exactly with the allowed units.
struct FractionalPartDisplayStrategy
Overview
For example, you can change this option to show a duration of 1 hour and 15 minutes as “1.25 hr”, “1 hr”, or “1.5 hr” with different lengths and rounding rules when hour is the only allowed unit.
Topics
Initializers
init(from: any Decoder) throwsinit<Range>(lengthLimits: Range, roundingRule: FloatingPointRoundingRule, roundingIncrement: Double?)Displays the remaining part as the fractional part of the smallest unit.
Instance Properties
var maximumLength: Intvar minimumLength: Intvar roundingIncrement: Double?var roundingRule: FloatingPointRoundingRule
Type Properties
static var hide: Duration.UnitsFormatStyle.FractionalPartDisplayStrategyExcludes the remaining part.
Type Methods
static func hide(rounded: FloatingPointRoundingRule) -> Duration.UnitsFormatStyle.FractionalPartDisplayStrategyExcludes the remaining part with the specified rounding rule.static func show(length: Int, rounded: FloatingPointRoundingRule, increment: Double?) -> Duration.UnitsFormatStyle.FractionalPartDisplayStrategyDisplays the remaining part as the fractional part of the smallest unit.
Relationships
Conforms To
Swift.DecodableSwift.EncodableSwift.EquatableSwift.HashableSwift.SendableSwift.SendableMetatype