<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/PreviewCamera",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport13PreviewCameraV"
  },
  "title" : "PreviewCamera"
}
-->

# PreviewCamera

A camera that defines a viewpoint in a preview.

```
struct PreviewCamera
```

## Overview

Use one or more preview cameras with one of the preview macros that takes a
`cameras` input — like
<doc://com.apple.documentation/documentation/SwiftUI/Preview(_:traits:body:cameras:)>
— to create custom viewpoints for the preview. The canvas offers
custom cameras in its camera picker along with a set of standard cameras.
The preview uses the first custom camera that you specify as the default
viewpoint when the preview appears.

For example, you can create custom cameras from the top, leading,
and front viewpoints:

```
#Preview {
    CircleImage()
} cameras: {
    PreviewCamera(from: .top, name: "Top")
    PreviewCamera(from: .leading, name: "Leading")
    PreviewCamera(from: .front, name: "Front")
}
```

## Topics

### Creating a preview camera

[`init(from:zoom:name:)`](/documentation/DeveloperToolsSupport/PreviewCamera/init(from:zoom:name:))

Creates a camera that looks toward the preview center from a
specified unit point.

[`init(lookingAt:from:name:)`](/documentation/DeveloperToolsSupport/PreviewCamera/init(lookingAt:from:name:))

Creates a camera that looks towards a specified point in the preview
from a different specified point.



---

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)