init(_:as:widget:timelineProvider:)
Creates a preview of a widget with a static configuration.
Declaration
@MainActor init(_ name: String? = nil, as family: WidgetFamily, widget: @escaping () -> some Widget, timelineProvider: @escaping () -> some TimelineProvider)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.