Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prism.byescaleira.com/llms.txt

Use this file to discover all available pages before exploring further.

Camera & Media

PrismCameraClient wraps AVFoundation’s capture pipeline into a clean, Sendable API. Capture photos and video without managing AVCaptureSession, delegates, or output configurations directly.

Permissions

Camera Permission
import PrismCapabilities

let permission = PrismCameraClient.permissionStatus
// .notDetermined, .restricted, .denied, .authorized

// Request access
let granted = try await PrismCameraClient.requestAccess()

Camera Positions

PositionDescription
.frontFront-facing (selfie) camera
.backRear-facing camera
.externalExternal camera (iPad, Mac)

Photo Capture

Capture a Photo
let camera = PrismCameraClient(position: .back)

try await camera.start()

let settings = PrismPhotoSettings(
    flashMode: .auto,
    isHDREnabled: true,
    quality: .high
)

let photo = try await camera.capturePhoto(settings: settings)
// photo.imageData contains the captured JPEG/HEIC data

await camera.stop()

Photo Quality Levels

QualityDescription
.lowSmallest file size, reduced resolution
.mediumBalanced quality and size
.highHigh-resolution output
.maximumFull sensor resolution

Flash Modes

ModeBehavior
.offFlash disabled
.onFlash always fires
.autoFlash fires when needed

Video Capture

Switch to video mode for recording:
Record Video
let camera = PrismCameraClient(
    position: .back,
    mode: .video
)

try await camera.start()

// Start recording
try await camera.startRecording()

// ... record for desired duration ...

// Stop and get the file URL
let videoURL = try await camera.stopRecording()
print("Video saved to: \(videoURL)")

await camera.stop()

Switching Cameras

Switch Camera
// Switch from back to front
try await camera.switchPosition(to: .front)
Always call camera.stop() when you’re done. The camera session holds hardware resources and will prevent other apps from accessing the camera.

Photo Picker

For selecting existing media from the photo library, use PrismPhotoPicker from PrismUI:
Photo Picker (PrismUI)
import PrismUI

PrismPhotoPicker(
    selection: $selectedImage,
    filter: .images
)