Hi I followed a course by Jared Davidson to create a custom camera view and save pictures using AVFoundation. https://www.youtube.com/watch?v=w0O3ZGUS3pk
However I would
you can use this code to save your videos in the photo library , You have to give the follwing parameters in which the most important is OutputURL.path which is filesystem path to the movie file you want to save to the Camera Roll album , For the rest of the parameters you can either pass there respective values or you can also assign nil that depends on your need
func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) {
if (error != nil) {
print("Error recording movie: \(error!.localizedDescription)")
} else {
UISaveVideoAtPathToSavedPhotosAlbum(outputFileURL.path, nil, #selector(CameraController.video(_:didFinishSavingWithError:contextInfo:)), nil)
}
outputURL = nil
}