This is a download helper written in swift 4 to download files with progress and completion callbacks. This resumes the download even if user kills the app. There is one more file to manage file progress if you want to fetch progress asap.
To use this file, just add it on your project and call the fucntions mentioned in the file.
//To start a download
PrakrstaFileDownloader.shared.startDownload(url: "your unique video url")
//To check if it's already in queue.
PrakrstaFileDownloader.shared.isDownloading(url: "your unique video url")
override func viewWillAppear(){
PrakrstaFileDownloader.shared.progressCallback = downloadProgress(progress:id:)
PrakrstaFileDownloader.shared.completionDownload = downloadCompleted(success:id:)
}
func downloadProgress(progress: Double, id: String){
print("Progress \(progress) for id : \(id)")
}
func downloadCompleted(success: Bool, id: String){
print("downloadCompleted \(success) for id : \(id)")
}