---
title: "Preview(_:as:using:widget:timelineProvider:)"
framework: widgetkit
role: symbol
role_heading: Macro
path: "widgetkit/preview(_:as:using:widget:timelineprovider:)-3df1l"
---

# Preview(_:as:using:widget:timelineProvider:)

Preview a widget with an intent configuration, using the specified timeline provider.

## Declaration

```swift
@freestanding(declaration) macro Preview<Widget, Provider>(_ name: String? = nil, as family: WidgetFamily, using intent: Provider.Intent, widget: @escaping () -> Widget, timelineProvider: @escaping () -> Provider) where Widget : Widget, Provider : IntentTimelineProvider
```

## Parameters

- `name`: An optional display name for the preview that appears in the Xcode preview canvas.
- `family`: The widget family to display.
- `intent`: The intent with which to configure the widget.
- `widget`: A closure producing the widget to be previewed.
- `timelineProvider`: A closure producing the timeline provider that generates the preview’s timeline.

## Mentioned in

Previewing widgets and Live Activities in Xcode

## Overview

Overview Provide the preview with sample data and use it to step through the timeline while ignoring the dates of the entries, and test out the transitions between them. note: The timeline provider must be of the type that the widget expects.

## See Also

### Generating a widget preview

- [Preview(_:as:widget:timelineProvider:)](widgetkit/preview(_:as:widget:timelineprovider:).md)
- [Preview(_:as:using:widget:timelineProvider:)](widgetkit/preview(_:as:using:widget:timelineprovider:)-4ljg1.md)
- [Preview(_:as:widget:timeline:)](widgetkit/preview(_:as:widget:timeline:).md)
- [Preview(_:widget:relevanceEntries:)](widgetkit/preview(_:widget:relevanceentries:).md)
- [Preview(_:widget:relevanceProvider:)](widgetkit/preview(_:widget:relevanceprovider:).md)
- [Preview(_:widget:relevanceProvider:relevance:)](widgetkit/preview(_:widget:relevanceprovider:relevance:).md)
