---
title: main()
framework: swiftui
role: symbol
role_heading: Type Method
path: swiftui/widgetbundle/main()
---

# main()

Initializes and runs the widget bundle.

## Declaration

```swift
@MainActor @preconcurrency static func main()
```

## Overview

Overview Because you precede your WidgetBundle conformer’s declaration with the @main attribute, the system calls your widget bundle’s main() method to launch the widget bundle. SwiftUI provides a default implementation of the method that manages the launch process in a platform-appropriate way.

## See Also

### Running a widget bundle

- [init()](swiftui/widgetbundle/init().md)
