Kingfisher

 
 

Free Swift Library to Download & Cache Images

Open source Swift API that allows software developers to work with remote images inside their web apps. It allows to download and cache images, apply image processors and filters.

Kingfisher is a lightweight pure Swift implementation that provided complete functionality for working with multiple image file formats using Swift code. The library helps developers to create applications that can remotely handle images with ease. The library asynchronously downloads as well as cache images inside their own applications.  The library supports a multiple-layer cache for the downloaded images that immensely enhances the performance of the apps. That means images will be cached in memory as well as on disk so no need to download it again.

The library is very easy to handle and provides a facility for cache management. Users can easily set the size as well as the duration of the cache. It will also provide an automatic cache cleaning facility that helps users to prevent the library from utilizing too many resources. One other great feature is included for task cancellation. Users can easily cancel the downloading or image retrieving process if it is not needed anymore.  

The Kingfisher library facilitates developers to use image downloading and image caching components separately according to their needs. You can even create your own cache according to your own needs using Swift code. It Improves the disk cache performance by avoiding unnecessary disk operations. The library is open source and is available under the   MIT License.

Previous Next

Getting Started with Kingfisher

Clone the latest sources with using the following command

 

Install Kingfisher via GitHub.

$ git submodule add https://github.com/onevcat/Kingfisher.git 

Download & Use Images using Swift

The open source Nuke API provides a well-organized and effective way for downloading and using images inside your Swift apps. To fetch the images you need to pass the URL of the required image and then call the resume method. It will download the requested image in the background and will inform the response closure when it’s done.

Preheat Image using Swift API

Preheating is a very useful feature that enables users to download the image or other data ahead of time in anticipation of its use.  The apps can download it and store it in the application’s network cache. Later when you need to view the image the response to your request will come back from the cache instead of the network. The open source API Nuke has included support for an exciting feature known as preheating images using Swift code. Please remember that preheating can takes up users' data and puts extra pressure on the CPU as well as memory. To reduce this pressure you can choose only the disk cache as the prefetching destination.

Load and Cash Images via Swift

Image caching is a very useful method that improves application performance and end-user experience. The open source Nuke API enables software apps to automatically cache the downloaded images. Nuke relies on two built-in caching layers.  The first one is used to store processed image, which is ready for display. It uses the LRU algorithm – the least recently used entries are removed first during the sweep. The 2nd one uses HTTP Disk Cache to store the unprocessed image data. It is also possible to check the existence of the requested image in the cache.