Instance Property

hasTorch

A Boolean value that specifies whether the capture device has a torch.

Declaration

var hasTorch: Bool { get }

Discussion

A torch is a light source, such as an LED flash, that is available on the device and used for illuminating captured content or providing general illumination. This property reflects whether the current device has such illumination hardware built-in.

Even if the device has a torch, that torch might not be available for use. Thus, you should also check the value of the isTorchAvailable property before using it.

You can observe changes to the value of this property using Key-value observing.

See Also

Managing Torch Settings

var isTorchAvailable: Bool

Indicates whether the torch is currently available for use.

var isTorchActive: Bool

A Boolean value indicating whether the device’s torch is currently active.

var torchLevel: Float

The current torch brightness level.

func isTorchModeSupported(AVCaptureDevice.TorchMode) -> Bool

Returns a Boolean value that indicates whether the device supports the specified torch mode.

func setTorchModeOn(level: Float)

Sets the illumination level when in torch mode.

enum AVCaptureDevice.TorchMode

Constants to specify the capture device’s torch mode.