TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2015 |
SPMSupports SPM | ✗ |
Maintained by Thibault Charbonnier.
Powerful file downloads for iOS 7+ with NSURLSession in Swift.
TCBlobDownloadSwift makes it easy to quickly download one or several large file(s) from your backend or the Internet right into your app. Give it an URL, a directory (or not, it can also download into the user's tmp folder), a name (or not, it can also give your file a default name), and it will take care of everything.
See the Usage section for examples.
NSURLSession
(including background downloads/pause/resume)TCBlobDownloadSwift.xcodeproj
from the Finder to your opened project's file navigator.TCBlobDownloadSwift.framework
.TCBlobDownloadSwift.framework
.For iOS 7 and other targets which do not support embedded frameworks, copy the source files (Source/*.swift}
) into your project.
Before checking the iOS example project, here is how TCBlobDownloadSwift works in a few lines of code:
Coming!
import TCBlobDownloadSwift
// Here is a simple delegate implementing TCBlobDownloadDelegate.
class DownloadHandler: NSObject, TCBlobDownloadDelegate {
init() {}
func download(download: TCBlobDownload, didProgress progress: Float, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
println("\(progress*100)% downloaded")
}
func download(download: TCBlobDownload, didFinishWithError error: NSError?, atLocation location: NSURL?) {
println("file downloaded at \(location)")
}
}
let fileURL = NSURL(string: "http://some.huge/file.mp4")
let download = TCBlobDownloadManager.sharedInstance
.downloadFileAtURL(fileURL!, toDirectory: nil, withName: nil, andDelegate: DownloadHandler())