<!--
{
  "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/ListFormatStyle",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation15ListFormatStyleV"
  },
  "title" : "ListFormatStyle"
}
-->

# ListFormatStyle

A type that formats lists of items with a separator and conjunction appropriate for a given locale.

```
struct ListFormatStyle<Style, Base> where Style : FormatStyle, Base : Sequence, Style.FormatInput == Base.Element, Style.FormatOutput == String
```

## Overview

A list format style creates human readable text from a <doc://com.apple.documentation/documentation/Swift/Sequence> of values. Customize the formatting behavior of the list using the [`width`](/documentation/Foundation/ListFormatStyle/width-swift.property), [`listType`](/documentation/Foundation/ListFormatStyle/listType-swift.property), and [`locale`](/documentation/Foundation/ListFormatStyle/locale) properties. The system automatically caches unique configurations of [`ListFormatStyle`](/documentation/Foundation/ListFormatStyle) to enhance performance.

Use either <doc://com.apple.documentation/documentation/Swift/Sequence/formatted()> or <doc://com.apple.documentation/documentation/Swift/Sequence/formatted(_:)>, both instance methods of <doc://com.apple.documentation/documentation/Swift/Sequence>, to create a string representation of the items.

The <doc://com.apple.documentation/documentation/Swift/Sequence/formatted()> method applies the default list format style to a sequence of strings. For example:

```swift
["Kristin", "Paul", "Ana", "Bill"].formatted()
// Kristin, Paul, Ana, and Bill
```

You can customize a list’s `type` and `width` properties.

- The [`listType`](/documentation/Foundation/ListFormatStyle/listType-swift.property) property specifies the semantics of the list.
- The [`width`](/documentation/Foundation/ListFormatStyle/width-swift.property) property determines the size of the returned string.

The <doc://com.apple.documentation/documentation/Swift/Sequence/formatted(_:)> method to applies a custom list format style. You can use the static factory method [`list(type:width:)`](/documentation/Foundation/FormatStyle/list(type:width:)) to create a custom list format style as a parameter to the method.

This example formats a sequence with a [`ListFormatStyle.ListType.and`](/documentation/Foundation/ListFormatStyle/ListType-swift.enum/and) list type and [`ListFormatStyle.Width.short`](/documentation/Foundation/ListFormatStyle/Width-swift.enum/short) width:

```swift
["Kristin", "Paul", "Ana", "Bill"].formatted(.list(type: .and, width: .short))
// Kristin, Paul, Ana, & Bill
```

You can provide a member format style to transform each list element to a string in applications where the elements aren’t already strings. For example, the following code sample uses an [`IntegerFormatStyle`](/documentation/Foundation/IntegerFormatStyle) to convert a range of integer values into a list:

```swift
(5201719 ... 5201722).formatted(.list(memberStyle: IntegerFormatStyle(), type: .or, width: .standard))
// For locale: en_US: 5,201,719, 5,201,720, 5,201,721, or 5,201,722
// For locale: fr_CA: 5 201 719, 5 201 720, 5 201 721, ou 5 201 722
```

> Note:
> The generated string is locale-dependent and incorporates linguistic and cultural conventions of the user.

You can create and reuse a list format style instance to format similar sequences. For example:

```swift
let percentStyle = ListFormatStyle<FloatingPointFormatStyle.Percent, StrideThrough<Double>>(memberStyle: .percent)
stride(from: 7.5, through: 9.0, by: 0.5).formatted(percentStyle)
// 7.5%, 8%, 8.5%, and 9%
stride(from: 89.0, through: 95.0, by: 2.0).formatted(percentStyle)
// 89%, 91%, 93%, and 95%
```

## Topics

### Creating a list format style

[`init(memberStyle:)`](/documentation/Foundation/ListFormatStyle/init(memberStyle:))

Creates an instance using the provided format style.

### Modifying a list format style

[`width`](/documentation/Foundation/ListFormatStyle/width-swift.property)

The size of the list.

[`ListFormatStyle.Width`](/documentation/Foundation/ListFormatStyle/Width-swift.enum)

The type representing the width of a list.

[`listType`](/documentation/Foundation/ListFormatStyle/listType-swift.property)

The type of the list.

[`ListFormatStyle.ListType`](/documentation/Foundation/ListFormatStyle/ListType-swift.enum)

A type that describes whether the returned list contains cumulative or alternative elements.

[`locale`](/documentation/Foundation/ListFormatStyle/locale)

The locale to use when formatting items in the list.

[`locale(_:)`](/documentation/Foundation/ListFormatStyle/locale(_:))

Modifies the list format style to use the specified locale.

### Applying list styles

[`format(_:)`](/documentation/Foundation/ListFormatStyle/format(_:))

Creates a locale-aware string representation of the value.

### Applying currency styles

[`IntegerFormatStyle.Currency`](/documentation/Foundation/IntegerFormatStyle/Currency)

A format style that converts between integer currency values and their textual representations.

### Applying measurement styles

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

A type that provides localized representations of measurements.

### Supporting types



---

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)