Contents

body

Declares the group of widgets that an app supports.

Declaration

@WidgetBundleBuilder @MainActor @preconcurrency var body: Self.Body { get }

Discussion

The order that the widgets appear in this property determines the order they are shown to the user when adding a widget. The following example shows how to use a widget bundle builder to define a body showing a game status widget first and a character detail widget second:

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

See Also

Implementing a widget bundle