<!--
{
  "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/Widget",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6WidgetP"
  },
  "title" : "Widget"
}
-->

# Widget

The configuration and content of a widget to display on the Home screen or
in Notification Center.

```
@MainActor @preconcurrency protocol Widget
```

## Overview

Widgets show glanceable and relevant content from your app right on the iOS
Home screen or in Notification Center on macOS. Users can add, configure, and
arrange widgets to suit their individual needs. You can provide multiple
types of widgets, each presenting a specific kind of information. When
users want more information, like to read the full article for a headline
or to see the details of a package delivery, the widget lets them get to
the information in your app quickly.

There are three key components to a widget:

- A configuration that determines whether the widget is configurable,
  identifies the widget, and defines the SwiftUI views that show the
  widget’s content.
- A timeline provider that drives the process of updating the widget’s view
  over time.
- SwiftUI views used by WidgetKit to display the widget.

For information about adding a widget extension to your app, and keeping
your widget up to date, see
<doc://com.apple.documentation/documentation/WidgetKit/Creating-a-Widget-Extension>
and
<doc://com.apple.documentation/documentation/WidgetKit/Keeping-a-Widget-Up-To-Date>,
respectively.

By adding a custom SiriKit intent definition, you can let users customize
their widgets to show the information that’s most relevant to them. If
you’ve already added support for Siri or Shortcuts, you’re well on your way
to supporting customizable widgets. For more information, see
<doc://com.apple.documentation/documentation/WidgetKit/Making-a-Configurable-Widget>.

A type conforming to this protocol inherits `@preconcurrency @MainActor`
isolation from the protocol if the conformance is included in the type’s
base declaration:

```
struct MyCustomType: Transition {
    // `@preconcurrency @MainActor` isolation by default
}
```

Isolation to the main actor is the default, but it’s not required. Declare
the conformance in an extension to opt out of main actor isolation:

```
extension MyCustomType: Transition {
    // `nonisolated` by default
}
```

## Topics

### Implementing a widget

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

The content and behavior of the widget.

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

The type of configuration representing the content of the widget.

### Running a widget

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

Creates a widget using `body` as its content.

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

Initializes and runs the widget.



---

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)