• Stars
    star
    152
  • Rank 243,430 (Top 5 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Powerful file downloads in Swift

TCBlobDownloadSwift

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.

Features

  • File downloads with NSURLSession (including background downloads/pause/resume)
  • File management (download directory + customizable filename)
  • Download tasks configuration (cookies, timeout, number of concurrent connections...)
  • Progression/Completion Protocol (delegate style)
  • Progression/Completion Closures
  • Complete example project with concurrent file downloading

Requirements

  • iOS 7.0+ / Mac OS X 10.9+

Installation

CocoaPods

Add the following to your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TCBlobDownloadSwift', '~> 0.1.0'

And run:

$ pod install

Here is a helpful article about setting up your project to use CocoaPods with Swift.

Import as an embedded framework
  • Drag and drop TCBlobDownloadSwift.xcodeproj from the Finder to your opened project's file navigator.
  • Project's Target -> Build Phases -> Target Dependencies -> add TCBlobDownloadSwift.framework.
  • Click on the + button at the top left of the panel and select "New Copy Files Phase". Set the "Destination" to "Frameworks", and add TCBlobDownloadSwift.framework.
Import source files

For iOS 7 and other targets which do not support embedded frameworks, copy the source files (Source/*.swift}) into your project.

Usage

Before checking the iOS example project, here is how TCBlobDownloadSwift works in a few lines of code:

Closures

Coming!

Delegate
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())

Roadmap

  • Documentation set
  • Full background download example
  • File upload

More Repositories

1

TCBlobDownload

Concurrent large files downloads for iOS
Objective-C
923
star
2

lua-resty-mlcache

Layered caching library for OpenResty
Perl
370
star
3

lua-resty-jit-uuid

Fast and dependency-free UUID library for LuaJIT/ngx_lua
Perl
201
star
4

lua-cassandra

Pure Lua driver for Apache Cassandra
Lua
99
star
5

lua-resty-socket

Automatic LuaSocket/cosockets compatibility module
Perl
36
star
6

TCCopyableLabel

A copyable UILabel subclass
Objective-C
34
star
7

lua-resty-busted

Test OpenResty scripts with busted
Lua
32
star
8

lua-argon2-ffi

LuaJIT FFI binding for the Argon2 password hashing algorithm
Lua
20
star
9

lua-argon2

Lua C binding for the Argon2 password hashing algorithm
C
20
star
10

Equiprose

A static website and blog generator in Node.js
JavaScript
12
star
11

MonteCarlo

A single and multithread Java implementation of the Monte Carlo algorithm.
Java
10
star
12

TCQueuePlayer

A wrapper class with controls for AVQueuePlayer
Objective-C
9
star
13

DTC3DViewAnimation

A nice iOS animation
Objective-C
7
star
14

lua-resty-multipart

Multipart parsing library for OpenResty
Lua
7
star
15

node-recursive-search

Recursively search a file in given directory
CoffeeScript
5
star
16

setup-openresty

JavaScript
3
star
17

TCProgressView

A customizable progress view for iOS
Objective-C
3
star
18

Counter

Simple Node.js and Socket.IO example.
JavaScript
2
star
19

kong-tests-compose

Docker compose for Kong's integration test suite
Shell
2
star
20

ECE_hadoop_mahout

Classification of tweets using Mahout
Java
1
star
21

Miranda

The original Equiprose
JavaScript
1
star
22

chasum.net

Personal website
HTML
1
star
23

lapis-syntax

A profound, purple based, dark colored theme for Atom.
CSS
1
star
24

macos-unused-files

Bash script to find unused files in a given period of time
Shell
1
star
25

homebrew-kong

Homebrew tap for Kong
Ruby
1
star
26

TweetStats

Assignment for the Software Quality course at ECE Paris 2013
Java
1
star