TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✓ |
Maintained by Chris Anderson.
Easily download massive numbers of files.
let urls = [ "image_url_1", "image_url_2" ]
let downloader = UXMBatchDownloader(urls: urls)
downloader.maximumConcurrentDownloads = 5
downloader.progress = { (file, progress) in
print("Finished Step \(progress) : \(file)")
}
downloader.start()
URL’s can be passed with or without a destination path. If no destination paths are passed, files will simply be downloaded to the documents folder with their original name.
var maximumConcurrentDownloads:Int
var completion:((urls: [String]) -> ())?
var progress:((file: String, progress: Float) -> ())?
init(urls: [String])
init(urls: [String], completion: ((urls: [String]) -> ())?)
init(objects: [UXMBatchObject])
init(objects: [UXMBatchObject], completion: ((urls: [String]) -> ())?)
func start()
func addUrl(url: String)
func addUrl(object: UXMBatchObject)
func addUrls(objects: [UXMBatchObject])
Instead of passing in just a URL’s, batch objects (UXMBatchObject) can be passed that contain a url, destination url, as well as options for number of download retries and whether or not the file should be backed up to iCloud.
var url:String
var destination:String?
var backupToCloud:Bool = false
var numberOfRetries:Int = 0
init(url: String, destination: String?, backupToCloud: Bool = false, numberOfRetries: Int = 0)
Chris Anderson:
UXMBatchDownloader is available under the MIT license. See the LICENSE file for more info.