Contents

badgeProminence(_:)

Specifies the prominence of badges created by this view.

Declaration

nonisolated func badgeProminence(_ prominence: BadgeProminence) -> some View

Parameters

  • prominence:

    The prominence to apply to badges.

Discussion

Badges can be used for different kinds of information, from the passive number of items in a container to the number of required actions. The prominence of badges in Lists can be adjusted to reflect this and be made to draw more or less attention to themselves.

Badges will default to standard prominence unless specified.

The following example shows a List displaying a list of folders with an informational badge with lower prominence, showing the number of items in the folder.

List(folders) { folder in
    Text(folder.name)
        .badge(folder.numberOfItems)
}
.badgeProminence(.decreased)

See Also

Displaying a badge on a list item