Instance Property


The currently active color space for capture.


var activeColorSpace: AVCaptureColorSpace { get set }


All devices and formats support capture in the sRGB color space. Some devices and formats can also capture in the P3 color space, which includes a much wider gamut of colors than the sRGB color space. By default, a capture session automatically enables wide-gamut capture for supported devices and capture workflows—for details, see the automaticallyConfiguresCaptureDeviceForWideColor of your capture session. To instead set the color space manually, disable that AVCaptureSession property before setting the active color space.

For best results, choose a color space before calling startRunning() on your capture session. Changing this property while a capture session is running requires a disruptive reconfiguration of the capture render pipeline—movie captures in progress will end immediately, unfulfilled photo requests will abort, and video preview will temporarily freeze.

Before changing this property, you must call the lockForConfiguration() method to obtain exclusive access to the capture device. Attempting to change this property without locking the device raises an exception (genericException).

See Also

Managing Color Spaces

enum AVCaptureColorSpace

Constants to specify the color gamut and format for image and video capture, used with the activeColorSpace property.