EDIT: To make things easier to anyone interested in checking out this problem, I added a demo project to this github repository.
Issue<
You must use, default method: appendingPathComponent()
The problem is that you're appending string to another string resulting in wrong path to the file like file:///var/mobile/Containers/Data/Application/<stripped>/DocumentsFinalVideo.mov
You should use appendingPathComponent() instead:
func createPath() -> URL {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
let documentDirectory = URL(fileURLWithPath: paths.first!)
let url = documentDirectory.appendingPathComponent("FinalVideo.mov")
if FileManager.default.fileExists(atPath: url.path) {
try? FileManager.default.removeItem(at: url)
}
return url
}