ControlGroupStyle

Defines the implementation of all control groups within a view hierarchy.

ProtocoliOS 15.0+macOS 12.0+tvOS 17.0+ControlGroupStyle in SwiftUI

Declaration

React
type ControlGroupStyle =
  | 'automatic'
  | 'compactMenu'
  | 'menu'
  | 'navigation'
  | 'palette'
  | AutomaticControlGroupStyle
  | CompactMenuControlGroupStyle
  | MenuControlGroupStyle
  | NavigationControlGroupStyle
  | PaletteControlGroupStyle;
Swift
@MainActor @preconcurrency protocol ControlGroupStyle

Pass a literal, or build one with SwiftUI.ControlGroupStyle from import { SwiftUI } from 'swiftui-react-native'.

Type properties

  • 'automatic'SwiftUI.ControlGroupStyle.automatic

    The default control group style.

  • 'compactMenu'SwiftUI.ControlGroupStyle.compactMenu

    A control group style that presents its content as a compact menu when the user presses the control, or as a submenu when nested within a larger menu.

  • 'palette'SwiftUI.ControlGroupStyle.palette

    A control group style that presents its content as a palette.

Overview

To configure the current ControlGroupStyle for a view hierarchy, use the View.controlGroupStyle(_:) modifier.

A type conforming to this protocol inherits @preconcurrency @MainActor isolation from the protocol if the conformance is included in the type's base declaration:

struct MyCustomType: Transition {
    // `@preconcurrency @MainActor` isolation by default
}

Isolation to the main actor is the default, but it's not required. Declare the conformance in an extension to opt out of main actor isolation:

extension MyCustomType: Transition {
    // `nonisolated` by default
}

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Styles.