Skip to content

Instance Property

width

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

Discussion

The width property controls the size of the list. The locale determines the formatting and abbreviation of the string for the given width.

For example, for English:

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

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

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

The default value is ListFormatStyle.Width.standard.