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

# list(type:width:)

Returns a format style to format a list of strings.

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

## Parameters

`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 a string 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), and the <doc://com.apple.documentation/documentation/Swift/Sequence> element type is <doc://com.apple.documentation/documentation/Swift/String>. 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 strings, then uses <doc://com.apple.documentation/documentation/Swift/Sequence/formatted(_:)> and the list format style provided by this method to format the items. It 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 = ["Atlantic", "Pacific", "Indian", "Arctic", "Southern"]
let formatted = items.formatted(
    .list(type:.and)
    .locale(Locale(identifier: "en_US"))) // "Atlantic, Pacific, Indian, Arctic, and Southern"
```

---

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)