Structure

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()
   }
}

See Also 参照

Implementing a Widget Bundle