<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/Preview/init(_:as:using:widget:timelineProvider:)-5335n",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport7PreviewV9WidgetKitE_2as5using6widget16timelineProviderACSSSg_AD0E6FamilyO6IntentQzq_ycxyctcAD0m8TimelineK0Rz7SwiftUI0E0R_r0_lufc"
  },
  "title" : "init(_:as:using:widget:timelineProvider:)"
}
-->

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

Creates a preview of a widget with an `INIntent` configuration.

```
@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.

---

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)