StructureFoundationInternationalization
Duration.TimeFormatStyle.Attributed
iOS 16.0+
iPadOS 16.0+
Mac Catalyst 16.0+
macOS 13.0+
tvOS 16.0+
watchOS 9.0+
Formats a duration as an attributed string with the
durationField attribute key and FoundationAttributes.DurationFieldAttribute attribute.@dynamicMemberLookup struct Attributed
Overview
For example, two hour, 43 minute and 26.25 seconds can be formatted as an attributed string, “2:43:26.25” with the following run text and attributes:
2 { durationField: .hours }
: { nil }
43 { durationField: .minutes }
: { nil }
26.25 { durationField: .seconds }
Topics
Initializers
Instance Methods
func format(Duration) -> AttributedStringFormats a duration as an attributed string withDurationFieldAttribute.func grouping(NumberFormatStyleConfiguration.Grouping) -> Duration.TimeFormatStyle.AttributedReturns a modified style that applies the givengroupingrule to the highest field in the pattern.func locale(Locale) -> Duration.TimeFormatStyle.AttributedModifies the format style to use the specified locale.
Subscripts
Default Implementations
Relationships
Conforms To
DiscreteFormatStyleFormatStyleSwift.CopyableSwift.DecodableSwift.EncodableSwift.EquatableSwift.EscapableSwift.HashableSwift.SendableSwift.SendableMetatype