Contents

WidgetBundleBuilder

A custom attribute that constructs a widget bundle’s body.

Declaration

@resultBuilder struct WidgetBundleBuilder

Overview

Use the @WidgetBundleBuilder attribute to group multiple widgets listed in the body property of a widget bundle. For example, the following code defines a widget bundle that consists of two widgets.

@main
struct GameWidgets: WidgetBundle {
   @WidgetBundleBuilder
   var body: some Widget {
       GameStatusWidget()
       CharacterDetailWidget()
   }
}

Topics

Bundling widgets

See Also

Implementing a widget bundle