Instance Method


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


func ramp(toVideoZoomFactor factor: CGFloat, withRate rate: Float)



The new magnification factor.


The rate at which to transition to the new magnification factor, specified in powers of two per second.


Allowed values for factor range from 1.0 (full field of view) to the videoMaxZoomFactor specified by the active capture format.

During a ramp, the zoom factor changes at an exponential rate, but this yields a visually linear transition. The rate parameter controls the speed of this transition independent of direction; for example, a value of 1.0 causes zoom factor to double every second if zooming in (that is, if the specified factor is greater than the current videoZoomFactor) or halve every second if zooming out.

Before calling this method, you must call lockForConfiguration() to acquire exclusive access to the device’s configuration properties. If you do not, calling this method raises an exception. When you finish configuring the device, call unlockForConfiguration() to release the lock and allow other devices to configure the settings.

See Also

Managing Zoom Settings

var videoZoomFactor: CGFloat

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

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 isRampingVideoZoom: Bool

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

func cancelVideoZoomRamp()

Smoothly ends a zoom transition in progress.

var virtualDeviceSwitchOverVideoZoomFactors: [NSNumber]

An array of video zoom factors at or above which a virtual device, such as the dual camera, may switch to its next constituent device.

var dualCameraSwitchOverVideoZoomFactor: CGFloat

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