---
title: "init(view:deviceTypes:changeHandler:)"
framework: AVKit
role: symbol
role_heading: Initializer
platforms: [iOS 27.1+, iPadOS 27.1+]
path: "avkit/avcapturedevicedirectioncoordinator/init(view:devicetypes:changehandler:)"
---

# init(view:deviceTypes:changeHandler:)

Creates a coordinator that reports the direction cameras face in relation to the specified view.

## Declaration

```swift
init(view: UIView, deviceTypes: [AVCaptureDevice.DeviceType], changeHandler: ((AVCaptureDeviceDirectionMap) -> Void)? = nil)
```

## Parameters

- `view`: The view that camera directions are relative to.
- `deviceTypes`: The device types the coordinator considers. It reports no other cameras.
- `changeHandler`: A callback the coordinator invokes on the main actor soon after you create it, and again each time a camera changes direction. It receives an doc://com.apple.avkit/documentation/AVKit/AVCaptureDeviceDirectionMap that groups the cameras by the direction they now face. Pass nil to read doc://com.apple.avkit/documentation/AVKit/AVCaptureDeviceDirectionCoordinator/deviceDirections yourself instead of receiving updates. A coordinator keeps the handler it’s created with, so create a new coordinator to change it.

## Discussion

Discussion note: Initialize the coordinator only on the main actor.
