<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/WidgetBundle",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12WidgetBundleP"
  },
  "title" : "WidgetBundle"
}
-->

# WidgetBundle

A container used to expose multiple widgets from a single widget extension.

```
@MainActor @preconcurrency protocol WidgetBundle
```

## Overview

To support multiple types of widgets, add the `@main` attribute to a
structure that conforms to `WidgetBundle`. For example, a game might have
one widget to display summary information about the game and a second
widget to display detailed information about individual characters.

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

## Topics

### Implementing a widget bundle

[`body`](/documentation/SwiftUI/WidgetBundle/body-swift.property)

Declares the group of widgets that an app supports.

[`Body`](/documentation/SwiftUI/WidgetBundle/Body-swift.associatedtype)

The type of widget that represents the content of the bundle.

[`WidgetBundleBuilder`](/documentation/SwiftUI/WidgetBundleBuilder)

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

### Running a widget bundle

[`init()`](/documentation/SwiftUI/WidgetBundle/init())

Creates a widget bundle using the bundle’s body as its content.

[`main()`](/documentation/SwiftUI/WidgetBundle/main())

Initializes and runs the widget bundle.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)