One Logo Pool Ball
WidgetKit · IOS API REFERENCE

StaticControlConfiguration

struct · iOS 18.0+ · SDK 27.1

@MainActor @preconcurrency struct StaticControlConfiguration<Content> where Content : ControlWidgetTemplate

The description of a control that has no user-configurable options. The following example shows the configuration for a garage door opener control. struct GarageDoorOpener: ControlWidget { var body: some ControlWidgetConfiguration { StaticControlConfiguration( kind: "com.yourcompany.GarageDoorOpener", provider: GarageDoorValueProvider() ) { isOpen in ControlWidgetToggle( "Garage Door", isOn: isOpen, action: ToggleGarageDoor() ) { Label( $0 ? "Open" : "Closed", systemImage: $0 ? "door.garage.open" : "door.garage.closed" ) } } } } Every control has a unique `kind`, a string that you choose to uniquely identify the type of control. You use this string to identify your control when reloading its template with ``ControlCenter``. The value provider is an object that determines a value to use to render your template. The content closure defines the template that WidgetKit needs to render the control. If you create the configuration using a value provider, when WidgetKit invokes the content closure, it passes a value created by the provider's ``ControlValueProvider/previewValue`` property or ``ControlValueProvider/currentValue()`` function.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

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

StaticControlConfiguration.body

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

StaticControlConfiguration.init(kind:content:)

callback cannot propagate synchronous failure

StaticControlConfiguration.init(kind:provider:content:)

This declaration needs Swift generic type arguments. (no canonical witness for Provider)

All WidgetKit types →