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.
- 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.
-
iOS 9.0+
-
Xcode 9.0+, Swift 4+
Download and drop the 'ILSImageCache.framework' into your Xcode project.Make Sure you add it by Embedded Binaries
- Use the ILSImageCache.framework in the folder 'AppStore Submission Framework' when you are submitting your application to the appstore
- 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)
- Help to add set cache size to hold until refresh
ILSImageCache.setCacheSize(_numberofitemscachecanhold: 10)
- Helps to remove cache when you want to clear
ILSImageCache.removeImageCaches()
- 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
}
- Also user can set the animation for image loading
public enum AnimationTypes : String
{
case hideEffect,dissolve,none
}
- 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)
iLeaf Solutions http://www.ileafsolutions.com