---
title: attributed
framework: swift
role: symbol
role_heading: Instance Property
path: swift/duration/unitsformatstyle/attributed-swift.property
---

# attributed

A property that formats the duration as an attributed string.

## Declaration

```swift
var attributed: Duration.UnitsFormatStyle.Attributed { get }
```

## Discussion

Discussion Apply the attributed property to a configured Duration.UnitsFormatStyle to produce an Duration.UnitsFormatStyle.Attributed style. You can then format a duration with this style to create a formatted   AttributedString. The formatted attributed string contains instances of AttributeScopes.FoundationAttributes.DateFieldAttribute and AttributeScopes.FoundationAttributes.MeasurementAttribute for runs with formatted durations. The following example formats a duration as an attributed string: let duration = Duration.seconds(70 * 60 + 32) +     Duration.milliseconds(400) let style = Duration.UnitsFormatStyle(allowedUnits: [.hours, .minutes, .seconds],                                       width: .abbreviated).attributed let attributedDuration = duration.formatted(style) The resulting attributedDuration, representing the string 1 hr, 10 min, 32 sec contains the following runs:  |   |   |   |   |   |   |   |   |   |   |   |

## See Also

### Formatting a duration as an attributed string

- [Duration.UnitsFormatStyle.Attributed](swift/duration/unitsformatstyle/attributed-swift.struct.md)
