---
title: "list(type:width:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/formatstyle/list(type:width:)"
---

# list(type:width:)

Returns a format style to format a list of strings.

## Declaration

```swift
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 (doc://com.apple.foundation/documentation/Foundation/ListFormatStyle/ListType-swift.enum/and) or alternative (doc://com.apple.foundation/documentation/Foundation/ListFormatStyle/ListType-swift.enum/or) elements.
- `width`: The width to use when formatting, such as doc://com.apple.foundation/documentation/Foundation/ListFormatStyle/Width-swift.enum/standard or doc://com.apple.foundation/documentation/Foundation/ListFormatStyle/Width-swift.enum/narrow.

## Return Value

Return Value A list format style that formats a string array as a textual list of items.

## Discussion

Discussion Use the dot-notation form of this type method when the call point allows the use of ListFormatStyle, and the Sequence element type is String. You typically do this when calling the formatted(_:) method of Sequence. The following example creates an array of strings, then uses 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”). 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"

## See Also

### Applying list styles

- [list(memberStyle:type:width:)](foundation/formatstyle/list(memberstyle:type:width:).md)
