Skip to content

Instance Property

listType

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
The type of the list.
var listType: ListFormatStyle<Style, Base>.ListType

Discussion

The list type determines the semantics used in the return string.

For example, for en_US:

["One", "Two", "Three"].formatted(.list(type: .and))
// "One, Two, and Three"

["One", "Two", "Three"].formatted(.list(type: .or))
// "One, Two, or Three"

The default value is ListFormatStyle.ListType.and.