<!--
{
  "availability" : [
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/Preview/init(_:widget:relevanceEntries:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport7PreviewV9WidgetKitE_6widget16relevanceEntriesACSSSg_q_ycSayxGyYaScMYcctcAD14RelevanceEntryRz7SwiftUI0E0R_r0_lufc"
  },
  "title" : "init(_:widget:relevanceEntries:)"
}
-->

# init(_:widget:relevanceEntries:)

Creates a preview of a relevance-driven widget.

```
@MainActor init<Entry>(_ name: String? = nil, widget: @escaping () -> some Widget, @PreviewRelevanceEntryBuilder<Entry> relevanceEntries: @escaping @MainActor () async -> [Entry]) where Entry : RelevanceEntry
```

## 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)