Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created October 8, 2021 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/2fb97dd60beb6da0228c4bc1746bbe5c to your computer and use it in GitHub Desktop.
Save anupamchugh/2fb97dd60beb6da0228c4bc1746bbe5c to your computer and use it in GitHub Desktop.
private let captureSession = AVCaptureSession()
private func setCameraInput() {
guard let device = AVCaptureDevice.DiscoverySession(
deviceTypes: [.builtInWideAngleCamera, .builtInDualCamera, .builtInTrueDepthCamera],mediaType: .video, position: .back).devices.first else {
fatalError("No back camera device found.")
}
let cameraInput = try! AVCaptureDeviceInput(device: device)
self.captureSession.addInput(cameraInput)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment