<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Measurement/AttributedStyle",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11MeasurementVAASo11NSDimensionCRbzrlE15AttributedStyleV"
  },
  "title" : "Measurement.AttributedStyle"
}
-->

# Measurement.AttributedStyle

A type that provides localized representations of measurements with an attributed string.

```
@dynamicMemberLookup struct AttributedStyle
```

## Overview

Use either the [`formatted()`](/documentation/Foundation/Measurement/formatted()) or the [`formatted(_:)`](/documentation/Foundation/Measurement/formatted(_:)) instance method of [`Measurement`](/documentation/Foundation/Measurement) to create an attributed string representation of a measurement.

The [`formatted()`](/documentation/Foundation/Measurement/formatted()) method generates a string using the default measurement format style.

## Topics

### Formatting a Measurement

[`func format(Measurement<UnitType>) -> AttributedString`](/documentation/Foundation/Measurement/AttributedStyle/format(_:))

Creates a string representation of a measurement.

### Modififying a Measurement Attributed Style

[`func locale(Locale) -> Measurement<UnitType>.AttributedStyle`](/documentation/Foundation/Measurement/AttributedStyle/locale(_:))

Modifies the measurement format style to use the specified locale.

### Comparing Measurement Attributed Styles

[`static func == <LeftHandSideType, RightHandSideType>(Measurement<LeftHandSideType>, Measurement<RightHandSideType>) -> Bool`](/documentation/Foundation/Measurement/==(_:_:))

Compare two measurements of the same `Dimension`.

### Supporting Types

### Structures

[`struct ByteCount`](/documentation/Foundation/Measurement/AttributedStyle/ByteCount)

A format style that converts byte counts into attributed strings.

### Subscripts

[`subscript<T>(dynamicMember _: KeyPath<Measurement<UnitType>.FormatStyle, T>) -> T`](/documentation/Foundation/Measurement/AttributedStyle/subscript(dynamicMember:)-83rva)

[`subscript<T>(dynamicMember _: WritableKeyPath<Measurement<UnitType>.FormatStyle, T>) -> T`](/documentation/Foundation/Measurement/AttributedStyle/subscript(dynamicMember:)-c2b1)

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Encodable`](/documentation/Swift/Encodable)

[`Hashable`](/documentation/Swift/Hashable)

[`Decodable`](/documentation/Swift/Decodable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`FormatStyle`](/documentation/Foundation/FormatStyle)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)