---
title: "init(device:previewLayer:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcapturedevice/rotationcoordinator/init(device:previewlayer:)"
---

# init(device:previewLayer:)

Creates a coordinator that provides separate compensation angles for content your app takes with a capture device, and for your app’s camera preview.

## Declaration

```swift
init(device: AVCaptureDevice, previewLayer: CALayer?)
```

## Parameters

- `device`: A capture device the new coordinator monitors to track its physical rotation to calculate its doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelCapture property.
- `previewLayer`: A layer that displays a camera preview the new coordinator monitors to calculate its doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelPreview property.
