How it works
A ListItemTint describes how a list row should color its tintable content — the colorized glyph of an icon, a selection accent, or a swipe control — when it appears inside a List. Rather than overriding every child view's color by hand, you hand the list a single tint value and let it decide which elements to tint and how to blend that color with the row's current state. Reach for it when you want per-row accents that read as deliberate list styling rather than ad-hoc foreground coloring, and when you want the system to keep honoring the user's accent and appearance settings where appropriate.
Apply a tint with listItemTint(_:)
The primary entry point is the
listItemTint(_:)modifier, which you attach to a row to set theListItemTintfor that item's tintable content. In the example eachLabelcarries its own call —.listItemTint(.yellow),.listItemTint(.red), and.listItemTint(.green)— so every row in theListresolves its accent independently.Tint the row's symbolic content
ListItemTinttargets the parts of a row the system considers tintable, most visibly an SF Symbol rendered byLabel(_:systemImage:). Here the colored glyphsstar.fill,flag.fill, andcheckmark.circle.fillpick up the yellow, red, and green tints respectively, so the icon — not the surrounding label text — reflects the supplied color.Choose a fixed tint
Pass a concrete
Colorto lock a row to an explicit accent regardless of the user's accent settings. The.yellow,.red, and.greenvalues are fixed tints in this form, giving each row a stable, intentional color that won't shift with the system accent.Opt rows into the user's accent
ListItemTintalso offers monochrome and accent-following behaviors so a row can defer to the appearance the system would normally apply. Where the demo uses a literalColor, you could instead resolve to the user's chosen accent so the tint stays consistent with the rest of the interface — useful when you want emphasis without dictating a specific hue.
.listItemTint(.yellow) on the Favorites row to .listItemTint(.blue) and watch only the star.fill glyph recolor while the other rows keep their own tints.Example & preview
Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.
struct ListItemTintDemo: View {
var body: some View {
List {
Label("Favorites", systemImage: "star.fill")
.listItemTint(.yellow)
Label("Flagged", systemImage: "flag.fill")
.listItemTint(.red)
Label("Synced", systemImage: "checkmark.circle.fill")
.listItemTint(.green)
}
}
}