Instance Property

flashMode

A setting for whether to fire the flash when capturing photos.

Declaration

var flashMode: AVCaptureDevice.FlashMode { get set }

Discussion

The default value for this setting is AVCaptureDevice.FlashMode.off.

Assuming a static scene, using the AVCaptureDevice.FlashMode.auto setting is equivalent to testing the AVCapturePhotoOutput isFlashScene property (which indicates whether flash is recommended for the scene currently visible to the camera), and then setting the flashMode property of your photo settings output accordingly before requesting a capture. However, the visible scene can change between when you request a capture and when the camera hardware captures an image—the automatic setting ensures that the flash is enabled or disabled appropriately at the moment of capture. When the capture occurs, your AVCapturePhotoCaptureDelegate methods receive an AVCaptureResolvedPhotoSettings object whose isFlashEnabled property indicates which flash mode was used for that capture.

When specifying a flash mode, the following requirements apply:

The capture output validates these requirements when you call the capturePhoto(with:delegate:) method. If your settings do not meet these requirements, that method raises an exception.

See Also

Configuring Photo Settings

var isAutoRedEyeReductionEnabled: Bool

A Boolean value that determines whether to use auto red-eye reduction on flash captures.

var isHighResolutionPhotoEnabled: Bool

A Boolean value that specifies whether to capture still images at the highest resolution supported by the active device and format.

var isCameraCalibrationDataDeliveryEnabled: Bool

A Boolean value that determines whether a dual photo capture also delivers camera calibration data.

var photoQualityPrioritization: AVCapturePhotoOutput.QualityPrioritization

A setting that indicates how to prioritize photo quality against speed of photo delivery.

var isAutoVirtualDeviceFusionEnabled: Bool

A Boolean value that specifies whether to use automatic virtual-device image fusion.

var virtualDeviceConstituentPhotoDeliveryEnabledDevices: [AVCaptureDevice]

The constituent devices for which the virtual device should deliver photos.

var isAutoStillImageStabilizationEnabled: Bool

A Boolean value that specifies whether captures use automatic image stabilization.

Deprecated
var isAutoDualCameraFusionEnabled: Bool

A Boolean value that specifies whether captures automatically combine data from a dual camera device.

Deprecated
var isDualCameraDualPhotoDeliveryEnabled: Bool

A Boolean value that determines whether a dual camera device delivers images from both cameras.

Deprecated