GithubHelp home page GithubHelp logo

ileafsolutions / ilsimagecache Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 1.09 MB

ILSImageCache is a lightweight, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift alternative in your next app.

Swift 38.51% C 57.02% Objective-C 4.47%
swift-library uiimageview uibutton xcode imagecache imagecaching imagedownload imagedownloader caching swift-4 download animation swift-alternative

ilsimagecache's Introduction

ILSImageCache

ILSImageCache is a lightweight, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift alternative in your next app.

Features

  • Asynchronous image downloading and caching.
  • URLSession-based networking.
  • Independent components. Use the downloader or caching system separately as you need.
  • Prefetching images and showing them from cache later when necessary.
  • Extensions for UIImageView and UIButton to directly set an image from a URL.
  • Built-in transition animation when setting images.
  • Customizable placeholder while loading images.
  • Extensible image processing and image format support.


Installation

Compatibility

  • iOS 9.0+

  • Xcode 9.0+, Swift 4+

Manual installation

Download and drop the 'ILSImageCache.framework' into your Xcode project.Make Sure you add it by Embedded Binaries

Note

  • Use the ILSImageCache.framework in the folder 'AppStore Submission Framework' when you are submitting your application to the appstore

Usage

  1. The simplest use-case is setting an image to an image view with the UIImageView extension:

let url = "url_of_your_image"

imageView.loadImageUsingCache(withUrl: url, placeholder:  placeholder image, animation: UIImageView.AnimationTypes.dissolve)
  1. Help to add set cache size to hold until refresh

ILSImageCache.setCacheSize(_numberofitemscachecanhold: 10)
  1. Helps to remove cache when you want to clear

ILSImageCache.removeImageCaches()
  1. Also have image downloader block method


ILSImageCache.loadImageusingCache(withUrl: imageUrl) { (status, image) in
guard let outPutimage = image
else
{
self.imageViewdwn.image =  imageLiteral(resourceName: "placeholder")
return
}
self.imageViewdwn.image = outPutimage
}
  1. Also user can set the animation for image loading 


public enum AnimationTypes : String
{
case hideEffect,dissolve,none

}
  1. Also ther is extension for UIButton
let url = "url_of_your_image"

button.loadImageUsingCache(withUrl: url, placeholder:  placeholder image, animation: UIButton.AnimationTypes.dissolve)

7.Added UIImage Extension to Resize your image on the basis of width

self.imageViewdwn.image = outPutimage.resizedImage(toWidth: self.imageViewdwn.frame.size.width)

7.Added UIImage Extension to Resize your image on the basis of percentage

self.imageViewdwn.image = outPutimage.resizedImage(withPercentage: 0.2)

Author

iLeaf Solutions http://www.ileafsolutions.com

ilsimagecache's People

Contributors

levindev avatar viveksn7291 avatar

Stargazers

 avatar  avatar  avatar  avatar  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.