Instance Method

capturePhoto(with:delegate:)

Initiates a photo capture using the specified settings.

Declaration

func capturePhoto(with settings: AVCapturePhotoSettings, delegate: AVCapturePhotoCaptureDelegate)

Parameters

settings

The settings for the photo capture, such as the output pixel format and flash mode. This method copies the provided AVCapturePhotoSettings object, so future changes to that object do not affect the capture in progress.

delegate

A delegate object to receive messages about capture progress and results. The photo output calls your delegate methods as the photo advances from capture to processing to delivery of finished images.

Discussion

Use this method for all variations of still photography, including single photo capture, RAW format capture (with or without a secondary format such as JPEG), bracketed capture of multiple images, and Live Photo capture.

When you call this method, the photo output validates the properties of your settings object to ensure deterministic behavior. For example, the flashMode setting must specify a value that is present in the photo output’s supportedFlashModes array. See each property’s description in the AVCapturePhotoSettings class reference for detailed validation rules.

See Also

Capturing a Photo

class AVCapturePhotoSettings

A specification of the features and settings to use for a single photo capture request.

class AVCapturePhotoBracketSettings

A specification of the features and settings to use for a photo capture request that captures multiple images with varied settings.

class AVCaptureResolvedPhotoSettings

A description of the features and settings in use for an in-progress or complete photo capture request.