Skip to content

iOS components Theming

stanceScopedTheme(_:)

Stable

Scopes a fixed theme to a subtree, for inverted sections and side-by-side previews.

  • PlatformiOS and iPadOS, SwiftUI
  • Builds onEnvironment
  • Kindmodifier

Preview

Rendered by the SwiftUI library, not drawn by hand.

stanceScopedTheme(_:) on iOS and iPadOSstanceScopedTheme(_:) on iOS and iPadOSstanceScopedTheme(_:) on iOS and iPadOS
stanceScopedTheme(_:), Light appearance
Light
stanceScopedTheme(_:), Dark appearance
Dark
stanceScopedTheme(_:), High contrast appearance
High contrast

Usage

swift
Text("Inverted").stanceScopedTheme(.dark)

Accessibility

  • Scoped themes keep the same verified contrast as page themes

On other platforms