Skip to content

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.

Notifications You must be signed in to change notification settings

ileafsolutions/ILSImageCache

Repository files navigation

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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published