-
-
Save sturdysturge/814a08b21afbb2a3b57e12b570242343 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension DataModel: DownloadDelegate { | |
func downloadProgressUpdated(for progress: Float) { | |
DispatchQueue.main.async { | |
self.progress = progress | |
self.progressText = String(format: "%.f%%", progress * 100) | |
} | |
} | |
func download() { | |
var urlString = "https://upload.wikimedia.org/wikipedia/commons/5/53/" | |
urlString.append("Almeida_J%C3%BAnior_-_Saudade_%28Longing%29_-_Google_Art_Project.jpg") | |
guard let url = URL(string: urlString) else {return} | |
self.activeDownload = Download(url: url) | |
guard let activeDownload = self.activeDownload else {return} | |
activeDownload.delegate = self | |
activeDownload.downloadTask = downloadsSession.downloadTask(with: url) | |
activeDownload.downloadTask?.resume() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment