<!--
{
  "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/FormatStyle/list(memberStyle:type:width:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11FormatStylePAAE4list06memberC04type5widthAA04ListbC0Vyqd__qd_0_Gqd___AI0H4TypeOyqd__qd_0__GAI5WidthOyqd__qd_0__GtAJRszAaBRd__STRd_0_7ElementQyd_0_0B5InputRtd__SS0B6OutputRtd__r0_lFZ"
  },
  "title" : "list(memberStyle:type:width:)"
}
-->

# list(memberStyle:type:width:)

Returns a format style to format a list of items.

```
static func list<MemberStyle, Base>(memberStyle: MemberStyle, type: ListFormatStyle<MemberStyle, Base>.ListType, width: ListFormatStyle<MemberStyle, Base>.Width = .standard) -> Self where Self == ListFormatStyle<MemberStyle, Base>, MemberStyle : FormatStyle, Base : Sequence, MemberStyle.FormatInput == Base.Element, MemberStyle.FormatOutput == String
```

## Parameters

`memberStyle`

The format style to apply to each item in the list.

`type`

The list type to apply, such as cumulative ([`ListFormatStyle.ListType.and`](/documentation/Foundation/ListFormatStyle/ListType-swift.enum/and)) or alternative ([`ListFormatStyle.ListType.or`](/documentation/Foundation/ListFormatStyle/ListType-swift.enum/or)) elements.

`width`

The width to use when formatting, such as [`ListFormatStyle.Width.standard`](/documentation/Foundation/ListFormatStyle/Width-swift.enum/standard) or [`ListFormatStyle.Width.narrow`](/documentation/Foundation/ListFormatStyle/Width-swift.enum/narrow).

## Return Value

A list format style that formats an array as a textual list of items.

## Discussion

Use the dot-notation form of this type method when the call point allows the use of [`ListFormatStyle`](/documentation/Foundation/ListFormatStyle). You typically do this when calling the <doc://com.apple.documentation/documentation/Swift/Sequence/formatted(_:)> method of <doc://com.apple.documentation/documentation/Swift/Sequence>.

The following example creates an array of integers, then uses <doc://com.apple.documentation/documentation/Swift/Sequence/formatted(_:)> and the list format style provided by this method to format the items. By using a currency [`IntegerFormatStyle`](/documentation/Foundation/IntegerFormatStyle), the list format style expresses each member as US dollars. The example also modifies the list format style to use the `en_US` locale, so the resulting string uses US English conventions for commas and conjunctions (“and”).

```swift
let items: [Int] = [100, 1000, 10000, 100000, 1000000]
let formatted = items.formatted(
    .list(memberStyle: .currency(code: "USD"),
          type: .and)
    .locale(Locale(identifier: "en_US"))) // "$100.00, $1,000.00, $10,000.00, $100,000.00, and $1,000,000.00"
```

---

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)