ControlGroup

A container view that displays semantically-related controls in a visually-appropriate manner for the context

ComponentiOS 15.0+macOS 12.0+tvOS 17.0+ControlGroup in SwiftUI

Declaration

React
import { ControlGroup } from 'swiftui-react-native';
Swift
nonisolated struct ControlGroup<Content> where Content : View

Initializers

5 SwiftUI initializers back <ControlGroup>. The props you pass pick one.

React
<ControlGroup>
  children?: ReactNode
</ControlGroup>
Swift
nonisolated init(@ContentBuilder content: () -> Content)
  • childrenReactNode

    Content. Strings become Text; React Native views are laid out by Yoga and placed by SwiftUI.

    Swift content: () -> Content

Also takes the common view props: modifiers, style and testID.

Overview

You can provide an optional label to this view that describes its children. This view may be used in different ways depending on the surrounding context. For example, when you place the control group in a toolbar item, SwiftUI uses the label when the group is moved to the toolbar's overflow menu.

ContentView()
    .toolbar(id: "items") {
        ToolbarItem(id: "media") {
            ControlGroup {
                MediaButton()
                ChartButton()
                GraphButton()
            } label: {
                Label("Plus", systemImage: "plus")
            }
        }
    }

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

Relationships

Conforms to

  • View

See also

More in Views.