Instance Property


A value that controls the cropping and enlargement of images captured by the device.


var videoZoomFactor: CGFloat { get set }


This value is a multiplier. For example, a value of 2.0 doubles the size of an image’s subject (and halves the field of view). Allowed values range from 1.0 (full field of view) to the value of the active format’s videoMaxZoomFactor property. Setting the value of this property jumps immediately to the new zoom factor. For a smooth transition, use the ramp(toVideoZoomFactor:withRate:) method.

The device achieves a zoom effect by cropping around the center of the image captured by the sensor. At low zoom factors, the cropped images is equal to or larger than the output size. At higher zoom factors, the device must scale the cropped image up to the output size, resulting in a loss of image quality. The active format’s videoZoomFactorUpscaleThreshold property indicates the factors at which upscaling will occur.

Before changing the value of this property, you must call lockForConfiguration() to acquire exclusive access to the device’s configuration properties. Otherwise, setting the value of this property raises an exception. When you are done configuring the device, call unlockForConfiguration() to release the lock and allow other devices to configure the settings.

See Also

Managing Zoom Settings

func ramp(toVideoZoomFactor: CGFloat, withRate: Float)

Begins a smooth transition from the current zoom factor to another.

func cancelVideoZoomRamp()

Smoothly ends a zoom transition in progress.

var isRampingVideoZoom: Bool

A Boolean value that indicates whether a zoom transition is in progress.

var minAvailableVideoZoomFactor: CGFloat

The minimum zoom factor allowed in the current capture configuration.

var maxAvailableVideoZoomFactor: CGFloat

The maximum zoom factor allowed in the current capture configuration.

var dualCameraSwitchOverVideoZoomFactor: CGFloat

The video zoom factor at which a dual camera device can automatically switch between cameras.