跳转至
Structure

ListItemTint

The configuration of a tint effect applied to content within a List.

Declaration

struct ListItemTint

Overview

Use this structure with the View/listItemTint(_:)-a71e4 view modifier to change the tint of an item in a list.

This structure has 3 options:

  1. fixed(_:): A tint Color that cannot be overriden by the system.
  2. preferred(_:): A tint Color that can be overriden by the system.
  3. monochrome: The standard gray tint effect.

See each of those pages for more details on the options.

Below is a simple example.

struct SettingsView: View {
    var body: some View {
        List {
            Label("Airplane Mode", systemImage: "airplane.circle.fill")
                .listItemTint(ListItemTint.fixed(Color.orange))
        }
    }
}
A screenshot displaying a single list item that reads "Airplane Mode" with a circular airplane icon to its left. The view modifier renders the icon as orange.

Availability

iOS 14.0+

macOS 11.0+

tvOS 14.0+

watchOS 7.0+

Topics


Type Property

monochrome A standard grayscale tint effect.


Type Method

fixed(_:) An explicit tint color.

preferred(_:) An explicit tint color that is overridable.