One Logo Pool Ball
SwiftUI · IOS API REFERENCE

ControlWidgetTemplateBuilder

struct · iOS 18.0+ · SDK 27.1

@resultBuilder struct ControlWidgetTemplateBuilder

A custom attribute that constructs a control widget template's body. The `@ControlWidgetTemplateBuilder` attribute allows your control template's body closure to produce a control template after zero or more other statements: struct GarageDoorOpener: ControlWidget { var body: some ControlWidgetConfiguration { let kind = "com.yourcompany.GarageDoorOpener" StaticControlConfiguration( kind: kind ) { let isOpen = ... ControlWidgetToggle( "Garage Door", isOn: isOpen, action: ToggleGarageDoor() ) { Label( $0 ? "Open" : "Closed", systemImage: $0 ? "door.garage.open" : "door.garage.closed" ) } } } }

Members (1)

static · iOS 18.0+

buildExpression

TypeScript
static buildExpression(content: EmptyControlWidgetTemplate): EmptyControlWidgetTemplate
Swift declaration
@export(implementation) static func buildExpression<Content>(_ content: Content) -> Content where Content : ControlWidgetTemplate

Builds an expression within the builder.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

ControlWidgetTemplateBuilder.buildBlock(_:)

This protocol needs associated types that cannot yet cross the bridge.

All SwiftUI types →