Giter Site home page Giter Site logo

mohsinalimat / download-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nsomar/download-manager

1.0 2.0 0.0 355 KB

iOS download manager, Download a set of files in parallel and sequential order.

License: BSD 3-Clause "New" or "Revised" License

Objective-C 92.84% Ruby 7.16%

download-manager's Introduction

##iOS download manager

Build Status

###A Minimalist download manager for iOS

Download a set of files in parallel or sequential order.

###What it provides

  • Easy to integrate and use iOS download manager.
  • Easily download file with the very robust AFNetworking library.
  • Deal only with NSURL, you will never have to keep strong or weak references of the Download managers.
  • Download files in sequential and parallel order.
  • Make sure each file (NSURL) is being downloaded only once.
  • Have multiple listener/delegates on a single download operation.
  • Download operation unique by URL, never download a URL twice.
  • Cache the downloaded file in Memory and on Disk using EGOCache.
  • Easily add and remove listeners to observe the download operations.
  • Singleton classes for fast access and minimum memory overhead.
  • Ensure that the UI Thread is never blocked.
  • Delegate or Block event callbacks.
  • All of the above in two lines of code.

###Motivation

Ever wanted to download a set of images in a parallel or sequential order, like creating a table cell view that resembles Facebook timeline cell that contains multiple images. If you tried to create such thing, then you realised that some images has to be downloaded before the others, namely the first image in the timeline cell must be downloaded before the second image in this same cell (remember we have multi images inside the same cell)

IADownloadManager, will help you download images or any other files in a parallel order. IASequentialDownloadManager, will help you download a set of urls in a sequential order.

###Installation ####Using CocoaPods (Recommended)

  1. Install CocoaPods on your machine Cocoapods
  2. Create a Podfile
  3. Add pod 'IADownloadManager' to your Podfile
  4. in the Terminal run 'pod install'
  5. open App.xcworkspace

####Manual Installation

  1. Copy all the files from IADownloadManager directory to your project.
  2. Copy the files from ThirdParty directory to your project
  3. Add CFNetwork.framework and Security.framework to the project, if you are not sure on how to add frameworks read the following SO answer

###Prerequisite To use the download manager you should have:

  • iOS 5
  • ARC

Third party needed (included within the sources of the project):

###How to use

Every download operation is identified by the NSURL of the file that is getting downloaded, The NSURL will be unique and cached against.

####Download files in parallel order using delegate callback.

Start the download operation

//Start the download operation, if the download operation is already started for this url,
//the urls will never be downloaded twice
[IADownloadManager downloadItemWithURL:url useCache:YES];

Attach Listener

//Attach a listener to the url
[IADownloadManager attachListener:self toURL:url];

Detach Listener

//Detach a listener to the url
[IADownloadManager detachListener:self];

Delegate methods

- (void)downloadManagerDidProgress:(float)progress;
- (void)downloadManagerDidFinish:(BOOL)success response:(id)response;

####Download files in Sequential order using delegate callback.

Start the download operation

//Start the download operation, if the download operation is already started for these urls,
//the urls will never be downloaded twice
[IASequentialDownloadManager downloadItemWithURLs:urls useCache:YES];

Attach Listener

//Attach a listener to the urls
[IASequentialDownloadManager attachListener:self toURLs:urls];

Detach Listener

//Detach a listener to the url
[IASequentialDownloadManager detachListener:self];

Delegate methods

- (void)sequentialManagerProgress:(float)progress atIndex:(int)index;
- (void)sequentialManagerDidFinish:(BOOL)success response:(id)response atIndex:(int)index;

####Block based callback.

There are also a set of blocks to be informed about the event of the download, For blocks based callbacks please refer to the demo.

download-manager's People

Contributors

briankenny avatar infusion-apps avatar lastmove avatar nsomar avatar ytzong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.