<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/Preview/init(_:traits:arguments:body:)-4ieth",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport7PreviewV6AppKitE_6traits9arguments4bodyACSSSg_AA0D5TraitVyAC10ViewTraitsOGdSayxGSo16NSViewControllerCxScMYcctclufc"
  },
  "title" : "init(_:traits:arguments:body:)"
}
-->

# init(_:traits:arguments:body:)

Creates a group of previews of an NSViewController.

```
@MainActor init<T>(_ name: String? = nil, traits: PreviewTrait<Preview.ViewTraits>..., arguments: [T], @PreviewBodyBuilder<NSViewController> body: @escaping @MainActor (T) -> NSViewController)
```

## Parameters

`name`

An optional display name for the preview.

`traits`

An optional list of traits to customize the preview.

`arguments`

An array of arguments to pass into `body`.

`body`

A closure that maps an argument to an NSViewController to preview.

## Discussion

A preview macro expands into a declaration that calls this initializer.
Don’t use this initializer 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)