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

# list(memberStyle:type:width:)

Returns a format style to format a list of items.

## Declaration

```swift
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 (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 an 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. You typically do this when calling the formatted(_:) method of Sequence. The following example creates an array of integers, then uses formatted(_:) and the list format style provided by this method to format the items. By using a currency 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”). 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"

## See Also

### Applying list styles

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