I am creating a camera app. I can take a image and the image is passing back to a view controller to show the image. It also saved to the camera roll. If I compare the image with the camera preview to the saved image, it seems like that the camera preview is a little bit zoomed in.
This is my code so far from the camera preview:
let cameraPreviewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
cameraPreviewLayer.videoGravity = .resizeAspectFill
cameraPreviewLayer.connection?.videoOrientation = .portrait
cameraPreviewLayer.frame = view.frame
view.layer.insertSublayer(cameraPreviewLayer, at: 0)
captureSession.startRunning()
How can I make the camera preview to the same size as the saved image?