<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/init(device:previewLayer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureDeviceRotationCoordinator(im)initWithDevice:previewLayer:"
  },
  "title" : "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.

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

## Parameters

`device`

A capture device the new coordinator monitors to track its physical rotation to calculate its [`videoRotationAngleForHorizonLevelCapture`](/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelCapture) property.

`previewLayer`

A layer that displays a camera preview the new coordinator monitors to calculate its [`videoRotationAngleForHorizonLevelPreview`](/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelPreview) property.

## Discussion

---

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)