A Swift package that floats your Persona in a corner of your field of view on visionOS. PersonaCam's primary use is for developers to record demo videos with a facecam on their Apple Vision Pro.
PersonaCam is not intended to be used in production apps. Wrap your PersonaCam calls in
#if DEBUGto keep them out of release builds.
In XCode: File → Add Package Dependencies… → paste https://github.com/robomex/PersonaCam → "Up to Next Major Version" from 0.2.1
Required — add the camera usage description to your Info.plist, without it your app will crash the moment the persona capture session tries to start. For example:
<key>NSCameraUsageDescription</key>
<string>Records your Persona for a face-cam overlay in demo videos.</string>PersonaCam offers two integration paths, depending on your app structure:
| If your app... | Use |
|---|---|
Has an ImmersiveSpace with a RealityView |
Path A |
| Is windows-only | Path B |
If your app uses an ImmersiveSpace:
.addPersonaCam(position: [chosen position], in: attachments)to yourcontentin themake:closure- Call
PersonaCamAttachment(size: [chosen size])in theattachments:closure
import PersonaCam
import RealityKit
import SwiftUI
ImmersiveSpace(id: "MyScene") {
RealityView { content, attachments in
// your existing 3D content…
content.addPersonaCam(position: .bottomCenter, in: attachments)
} attachments: {
PersonaCamAttachment(size: .regular)
}
}If your app does not use an ImmersiveSpace:
- Declare
PersonaCamScenein yourApp.body - Attach
.openPersonaCamOnAppear()to your window's root view:
import PersonaCam
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.openPersonaCamOnAppear()
}
PersonaCamScene(position: .bottomCenter, size: .regular)
}
}visionOS permits one immersive space across all apps at a time. If you later add your own immersive content, switch to Path A.
| Case | Where it appears in the field of view |
|---|---|
.topLeft |
Upper-left |
.topCenter |
Top center |
.topRight |
Upper-right |
.bottomLeft |
Lower-left |
.bottomCenter |
Bottom center |
.bottomRight |
Lower-right |
| Case |
|---|
.small |
.regular |
Use visionOS's built-in Record My View (Control Center → recording button) to capture your view as a video.
Reality Composer Pro's Developer Capture is another option.
- The virtual camera always faces "from" the primary
WindowGroup. If you walk past the primaryWindowGroup, the camera will aim towards the nonexistent back of your Persona's head. A potential (untested) remedy is theWindow Follow Modeenterprise API.
Apache License 2.0 — see LICENSE.