<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureVideoPreviewLayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureVideoPreviewLayer"
  },
  "title" : "AVCaptureVideoPreviewLayer"
}
-->

# AVCaptureVideoPreviewLayer

A Core Animation layer that displays video from a camera device.

```
class AVCaptureVideoPreviewLayer
```

## Overview

Use this layer to provide a preview of the content the camera captures. A convenient way to use this class in iOS is to set it as the backing layer for a view as shown below.

```swift
class PreviewView: UIView {
    // Use a capture video preview layer as the view's backing layer.
    override class var layerClass: AnyClass {
        AVCaptureVideoPreviewLayer.self
    }
    
    var previewLayer: AVCaptureVideoPreviewLayer {
        layer as! AVCaptureVideoPreviewLayer
    }
    
    // Connect the layer to a capture session.
    var session: AVCaptureSession? {
        get { previewLayer.session }
        set { previewLayer.session = newValue }
    }
}
```

## Topics

### Creating a preview layer

[`layerWithSession:`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/layerWithSession:)

Returns a new layer to preview the visual output of a capture session.

[`init(session:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/init(session:))

Creates a layer to preview the visual output of a capture session.

[`layerWithSessionWithNoConnection:`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/layerWithSessionWithNoConnection:)

Returns a new layer to preview the visual output of a capture session, without making connections to eligible video inputs.

[`init(sessionWithNoConnection:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/init(sessionWithNoConnection:))

Creates a layer to preview the visual output of a capture session, without making connections to eligible video inputs.

### Layer configuration

[`isPreviewing`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/isPreviewing)

A Boolean value that indicates whether the layer is rendering video frames from its source.

[`videoGravity`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/videoGravity)

A value that indicates how the layer displays video content within its bounds.

### Configuring deferred start

[`isDeferredStartSupported`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/isDeferredStartSupported)

A `BOOL` value that indicates whether the preview layer supports deferred start.

[`isDeferredStartEnabled`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/isDeferredStartEnabled)

A `BOOL` value that indicates whether to defer starting this preview layer.

### Session configuration

[`session`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/session)

A capture session with visual output to preview.

[`connection`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/connection)

An object that describes the connection from the layer to a particular input port.

[`setSessionWithNoConnection(_:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/setSessionWithNoConnection(_:))

Associates a session with the layer without automatically forming a connection to an eligible input port.

### Converting between coordinate spaces

[`layerPointConverted(fromCaptureDevicePoint:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/layerPointConverted(fromCaptureDevicePoint:))

Converts a point from the coordinate space of the capture device to the coordinate space of the layer.

[`captureDevicePointConverted(fromLayerPoint:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/captureDevicePointConverted(fromLayerPoint:))

Converts a point from layer coordinates to the coordinate space of the capture device.

[`layerRectConverted(fromMetadataOutputRect:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/layerRectConverted(fromMetadataOutputRect:))

Converts a rectangle from metadata output coordinates to the coordinate space of the layer.

[`metadataOutputRectConverted(fromLayerRect:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/metadataOutputRectConverted(fromLayerRect:))

Converts a rectangle from layer coordinates to the coordinate space of the metadata output.

[`transformedMetadataObject(for:)`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/transformedMetadataObject(for:))

Converts a metadata object’s visual properties to layer coordinates.

### Deprecated

[Deprecated symbols](/documentation/AVFoundation/avcapturevideopreviewlayer-deprecated-symbols)

Review unsupported symbols and their replacements.



---

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)