I am currently implementing a camera view with a toggle to switch between the front and back camera. I use a custom class to define a AVCaptureSession which captures the device input from either the front or the back camera, so I have the following instance vars:
private var captureSession = AVCaptureSession()
private var backCamera: AVCaptureDevice?
private var frontCamera: AVCaptureDevice?
private var currentCamera: AVCaptureDevice?
When the view controller is presented I'd like to set the currentCamera to the one the user has selected in the camera app. Does anyone know if this is possible and if so, how to achieve this?
Thanks in advance.