---
title: "Preview(_:traits:arguments:body:)"
framework: swiftui
role: symbol
role_heading: Macro
path: "swiftui/preview(_:traits:arguments:body:)"
---

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

Creates a group of previews of a parameterized SwiftUI view, varying its inputs over the provided arguments.

## Declaration

```swift
@freestanding(declaration) macro Preview<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. If you don’t specify a name, the canvas labels the preview using the line number where the preview appears in source.
- `traits`: Optional doc://com.apple.documentation/documentation/DeveloperToolsSupport/PreviewTrait instances that customizes the appearance of the preview.
- `arguments`: An array of inputs to pass into the preview’s body.
- `body`: A doc://com.apple.SwiftUI/documentation/SwiftUI/ContentBuilder mapping an argument to a SwiftUI view to preview.

## See Also

### Creating a preview

- [Preview(_:body:)](swiftui/preview(_:body:).md)
- [Preview(_:traits:_:body:)](swiftui/preview(_:traits:_:body:).md)
- [Preview(_:traits:body:cameras:)](swiftui/preview(_:traits:body:cameras:).md)
