Latest 0.1.6
Homepage https://github.com/robyxz/ImageCacher
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit, MapKit, AVFoundation
Authors

[![CI Status](http://img.shields.io/travis/Roberto Sartori/ImageCacher.svg?style=flat)](https://travis-ci.org/Roberto Sartori/ImageCacher)
Version
License
Platform

Usage

ImageCacher helps you to easily cache web images from a given URL using Core Data as persistent storage framework, GCD for background fetching and blocks for asynch operations.

ImageCacher strategy is straightforward: you ask for an image by specifying its URL, the singleton class then:

  • search the image into an internal memory structure as first attempt, it will call the handler immediatly before return with source = ICCacheSourceMemory
  • otherwise it will try to fetch the image in background form the caching database, it will call the handler in case of success at the end of the fetching operation (executed in background) with source = ICCacheSourceLocal
  • otherwise download the image from the URL, save it to the caching database and will call the handler with source = ICCacheSourceWeb
  • if URL is invalid or a fatal error occurs the handler il called with source = ICCacheSourceUnknown

The common usage pattern is the following:

    [[ICImageCacher shared] getImageWithURL:<myurl> withCompletionHandler^(UIImage *image ,tICCacheSource source) {
        switch (source) {
        case ICCacheSourceMemory:
            // image has been found into memory, this block is called WITHIN getImageWithURL execution
            break;

        case ICCacheSourceLocal:
            // image has been found into local caching database, this block is called later
            break;

        case ICCacheSourceWeb:
            // image has been downloaded for the first time, , this block is called later.
            // Next time this url will be fetched from memory or from local cache
            break;

        case ICCacheSourceUnknown:
            // image not found ad not downloaded (an error should has been encountered)
            break;
        }
    }];

Details

Requirements

Installation

ImageCacher is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ImageCacher"

Author

Roberto Sartori, [email protected]

License

ImageCacher is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ImageCacher",
    "version": "0.1.6",
    "summary": "ImageCacher helps you to manage image caching.",
    "description": "                        The image caching is asynchronous and based on blocks and GCD. The persistent storage is based on CoreData, fetches are executed in background, last accessed images are stored into a memory buffer.n",
    "homepage": "https://github.com/robyxz/ImageCacher",
    "license": "MIT",
    "authors": {
        "Roberto Sartori": "[email protected]"
    },
    "source": {
        "git": "https://github.com/robyxz/ImageCacher.git",
        "tag": "0.1.6"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "resource_bundles": {
        "ImageCacher": [
            "Pod/Assets/**"
        ]
    },
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": [
        "UIKit",
        "MapKit",
        "AVFoundation"
    ]
}

Pin It on Pinterest

Share This