<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureSystemZoomSlider/init(device:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureSystemZoomSlider(im)initWithDevice:action:"
  },
  "title" : "init(device:action:)"
}
-->

# init(device:action:)

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

```
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`](/documentation/AVFoundation/AVCaptureDevice/videoZoomFactor) property.

## Discussion

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

> Important:
> Don’t change the capture device’s video zoom factor when the system calls the action.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)