A powerful image loading and caching system

Caching

Fast LRU memory cache, native HTTP disk cache, and custom aggressive LRU disk cache.

Integrations

Customize image pipeline using built-in Alamofire, Gifu, FLAnimatedImage, WebP plugins or custom ones.

Progressive Images

Enable progressive decoding with a single line of code. Nuke supports for both progressive JPEG (built-in) and WebP (built by the community).

Preheating Images

Automatically prefetch images ahead of time using either Preheat or native table and collection view prefetching APIs.

Resumable Downloads

If the request fails or gets canceled and the image was partially loaded, resume where it was left off (HTTP range requests).

Animated Images

Use either FLAnimatedImage or Gifu plugin to display animated GIFs with smooth scrolling performance and low memory footprint.

Note: GIF is not the most efficient format for transferring and displaying animated images. The current best practice is to use short videos instead. See the demo project for more info.

Performance

Performance is one of the key differentiating factors for Nuke. There are three key components of its performance:

  • Main-Thread Performance. The framework was tuned to do as little work on the main thread as possible. It's at least 2.7x faster than other frameworks.
  • Robustness Under Stress. Nuke is completely asynchronous and works great under stress. It uses dedicated queues with limited concurrent task count and will even automatically rate limit the requests if necessary.
  • Memory Usage. Nuke uses LRU (least recently used) replacement algorithm. It limits memory usage to ~20% of available RAM, evicts images on memory warnings and removes even removes most of them when the app enters background.

Nuke also collects detailed performance metrics during the execution of each task.


Smooth Scrolling

Nuke is tuned to do very little work on the main thread which helps achieve buttery smooth scrolling performance in table and collection views.

RxNuke

RxNuke adds RxSwift extensions for Nuke and enables many common use cases:

  • Going from low to high resolution
  • Loading the first available image
  • Showing stale image while validating it
  • Load multiple images, display all at once
  • Auto retry requests

Here's an example of how easy it is to load go flow log to high resolution:

Observable.concat(pipeline.loadImage(with: lowResUrl).orEmpty,
                  pipeline.loadImage(with: highResUtl).orEmpty)
    .subscribe(onNext: { imageView.image = $0.image })
    .disposed(by: disposeBag)