<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/cameraAnchor(isActive:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP07_AVKit_aB0E12cameraAnchor8isActiveQrSb_tF"
  },
  "title" : "cameraAnchor(isActive:)"
}
-->

# cameraAnchor(isActive:)

Specifies the view that should act as the virtual camera for Apple Vision Pro
2D Persona stream.

```
@MainActor func cameraAnchor(isActive: Bool = true) -> some View
```

## Parameters

`isActive`

Whether or not the camera anchor is active.

    You can use this value to ensure that only one camera anchor is active at a time
    if you want to create multiple views that could act as the anchor in your app.

## Discussion

This modifier can be used by visionOS apps to specify the placement of the
virtual camera used to create a 2D stream of the user’s Persona. For example,
a video conferencing app might add this modifier to the view that shows the other
participants during a call. Then when the participant on visionOS looks at that
view their Persona will make eye contact with the other participants on the call.
The anchor will be at the center of the modified View.

```
ExampleAppVideoView()
    .cameraAnchor()
```

You might want to create multiple views with an anchor and then only activate
the one that has focus.

```
struct ExampleSelfPreviewWhenFocusedView: View {
   @Environment(\.isFocused) var isFocused: Bool

   var body: some View {
       ExampleAppVideoView()
        #if os(visionOS)
            .cameraAnchor(isActive: isFocused)
        #endif
   }
}
```

> Important:
> You should avoid creating multiple views with simultaneously active camera
> anchors. If multiple views with active camera anchors are found,
> the first created will have its parent View be used as the camera anchor,
> and a runtime error will be emitted.

---

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)