---
title: "init(_:traits:arguments:body:)"
framework: developertoolssupport
role: symbol
role_heading: Initializer
path: "developertoolssupport/preview/init(_:traits:arguments:body:)-1xqo1"
---

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

Creates a group of previews of a SwiftUI view.

## Declaration

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

## 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 a SwiftUI view to preview.

## Discussion

Discussion A preview macro expands into a declaration that calls this initializer. Don’t use this initializer directly.
