Contents

init(device:action:)

Creates a slider to control the zoom level of the specified capture device with an action to respond to zoom changes.

Declaration

init(device: AVCaptureDevice, action: @escaping @MainActor @Sendable (CGFloat) -> Void)

Parameters

  • device:

    The capture device to control.

  • action:

    An action the system calls on the main actor to respond to changes to the device’s Videozoomfactor property.

Discussion

The system calls the specified action only when the zoom slider changes the device’s videoZoomFactor property value. If your app needs to react to other sources of video zoom factor changes like ramp(toVideoZoomFactor:withRate:), use key-value observation instead.

See Also

Creating a zoom slider