Skip to content

iOS components Theming

stanceTheme(_:)

Stable

Modifier that applies a Stance appearance (system, light, dark or high contrast) to a view hierarchy.

  • PlatformiOS and iPadOS, SwiftUI
  • Builds onEnvironment
  • Kindmodifier

Preview

Rendered by the SwiftUI library, not drawn by hand.

stanceTheme(_:) on iOS and iPadOSstanceTheme(_:) on iOS and iPadOSstanceTheme(_:) on iOS and iPadOS
stanceTheme(_:), Light appearance
Light
stanceTheme(_:), Dark appearance
Dark
stanceTheme(_:), High contrast appearance
High contrast

Usage

swift
Text("Preview").stanceTheme(.highContrast)

Accessibility

  • Sets tint, foreground and canvas background from tokens

On other platforms