<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/PreviewRegistry",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport15PreviewRegistryP"
  },
  "title" : "PreviewRegistry"
}
-->

# PreviewRegistry

A protocol that the system uses to locate previews at runtime.

```
protocol PreviewRegistry
```

## Overview

Preview macros make use of this protocol on your behalf.
Don’t use it directly. Instead, use one of the preview macros, like
<doc://com.apple.documentation/documentation/SwiftUI/Preview(_:body:)>.

> Important: If you define a preview registry directly, the behavior is
> undefined.

## Topics

### Making a preview

[`static func makePreview() throws -> Preview`](/documentation/DeveloperToolsSupport/PreviewRegistry/makePreview())

[`static var preview: Preview`](/documentation/DeveloperToolsSupport/PreviewRegistry/preview)

[`static var column: Int`](/documentation/DeveloperToolsSupport/PreviewRegistry/column)

[`static var fileID: String`](/documentation/DeveloperToolsSupport/PreviewRegistry/fileID)

[`static var line: Int`](/documentation/DeveloperToolsSupport/PreviewRegistry/line)

### Getting errors

[`struct PreviewUnavailable`](/documentation/DeveloperToolsSupport/PreviewUnavailable)

An error that the system throws when a preview is unavailable at runtime.



---

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)