---
title: Duration.TimeFormatStyle.Attributed
framework: swift
role: symbol
role_heading: Structure
path: swift/duration/timeformatstyle/attributed-swift.struct
---

# Duration.TimeFormatStyle.Attributed

A format style that formats durations as attributed strings.

## Declaration

```swift
@dynamicMemberLookup struct Attributed
```

## Overview

Overview Apply the Duration.TimeFormatStyle.Attributed property to a configured Duration.TimeFormatStyle to produce an instance of this 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 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.TimeFormatStyle(pattern: .hourMinuteSecond).attributed let attributedDuration = duration.formatted(style) The resulting attributedDuration, representing the string 1:10:32 contains the following runs:  |   |   |   |   |   |

## Topics

### Formatting a duration

- [format(_:)](swift/duration/timeformatstyle/attributed-swift.struct/format(_:).md)

### Working with locales

- [locale(_:)](swift/duration/timeformatstyle/attributed-swift.struct/locale(_:).md)

### Instance Methods

- [grouping(_:)](swift/duration/timeformatstyle/attributed-swift.struct/grouping(_:).md)

### Subscripts

- [subscript(dynamicMember:)](swift/duration/timeformatstyle/attributed-swift.struct/subscript(dynamicmember:)-32lo0.md)
- [subscript(dynamicMember:)](swift/duration/timeformatstyle/attributed-swift.struct/subscript(dynamicmember:)-8cksi.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Decodable](swift/decodable.md)
- [DiscreteFormatStyle](foundation/discreteformatstyle.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [FormatStyle](foundation/formatstyle.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Formatting a duration as an attributed string

- [attributed](swift/duration/timeformatstyle/attributed-swift.property.md)
