Instance Method

colorScheme(_:)

Sets the view’s color scheme.

Declaration

func colorScheme(_ colorScheme: ColorScheme) -> some View

Parameters

colorScheme

The color scheme for this view.

Return Value

A view that sets this view’s color scheme.

Discussion

Use colorScheme(_:) to set the color scheme for the view to which you apply it and any subviews. If you want to set the color scheme for all views in the presentation, use preferredColorScheme(_:) instead.

See Also

Adopting View Color Schemes

func preferredColorScheme(ColorScheme?) -> View

Sets the preferred color scheme for this presentation.

enum ColorScheme

The possible types of color schemes, like Dark Mode.

struct PreferredColorSchemeKey

A key for specifying the preferred color scheme.