Contents

init(_:as:using:widget:timelineProvider:)

Creates a preview of a widget with an INIntent configuration.

Declaration

@MainActor init<Provider>(_ name: String? = nil, as family: WidgetFamily, using intent: Provider.Intent, widget: @escaping () -> some Widget, timelineProvider: @escaping () -> Provider) where Provider : IntentTimelineProvider

Discussion

The #Preview macro expands into a declaration that calls this initializer. To create a preview that appears in the canvas, you must use the macro, not instantiate a Preview directly.

See Also

Creating a preview of a widget