<!--
{
  "availability" : [
    "iOS: 13.0.0 - 27.0.0",
    "iPadOS: 13.0.0 - 27.0.0",
    "macCatalyst: 13.0.0 - 27.0.0",
    "macOS: 10.15.0 - 27.0.0",
    "tvOS: 13.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 6.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/previewDisplayName(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE18previewDisplayNameyQrSSSgF"
  },
  "title" : "previewDisplayName(_:)"
}
-->

# previewDisplayName(_:)

Sets a user visible name to show in the canvas for a preview.

```
nonisolated func previewDisplayName(_ value: String?) -> some View
```

## Parameters

`value`

A name for the preview.

## Return Value

A preview that uses the given name.

## Discussion

Apply this modifier to a view inside your [`PreviewProvider`](/documentation/SwiftUI/PreviewProvider)
implementation to associate a display name with that view’s preview:

```
struct CircleImage_Previews: PreviewProvider {
    static var previews: some View {
        CircleImage()
            .previewDisplayName("Circle")
    }
}
```

![A screenshot of the Xcode preview canvas cropped to just the top of a](images/com.apple.SwiftUI/View-previewDisplayName-1@2x.png)

Add a name when you have multiple previews together in the canvas that
you need to tell apart. The default value is `nil`, in which case
Xcode displays a default string.

---

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)