react-native-camera-kit/ios/ReactNativeCameraKit/RealPreviewView.swift
David Bertet a13aa787c4
Add iOS linter & report issues on PR (#634)
* Add iOS linter & report issues on PR

* Fix lint errors

---------

Co-authored-by: Seph Soliman <github@seph.dk>
2024-04-30 16:10:07 -07:00

27 lines
722 B
Swift

//
// RealPreviewView.swift
// ReactNativeCameraKit
//
import AVFoundation
class RealPreviewView: UIView {
// Use AVCaptureVideoPreviewLayer as the view's backing layer.
override class var layerClass: AnyClass {
AVCaptureVideoPreviewLayer.self
}
// Create an accessor for the right layer type
var previewLayer: AVCaptureVideoPreviewLayer {
// We can safely forcecast here, it can't change at runtime
// swiftlint:disable:next force_cast
return layer as! AVCaptureVideoPreviewLayer
}
// Connect the layer to a capture session.
var session: AVCaptureSession? {
get { previewLayer.session }
set { previewLayer.session = newValue }
}
}