A powerful image loading and caching system

Fast LRU memory and disk cache · SwiftUI · Smart background decompression · Image processing · Elegant builder API · Resumable downloads · Intelligent deduplication · Request prioritization · Low data mode · Prefetching · Rate limiting · Progressive JPEG, HEIF, WebP, GIF · Alamofire · Combine · Reactive extensions


Open on GitHub

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 create your own.

Progressive Rendering

Enable progressive decoding with a single line of code. Nuke supports progressive JPEG out of the box, and WebP via a plugin built by the community.

Prefetching

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

Resumable Downloads

If the request is terminated (either because of failure or cancellation) and the image was partially loaded, the next load will resume where it 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

Nuke does as little work on the main thread as possible. It is at least 3.5x faster than some competitive frameworks. It uses multiple optimizations to achieve that: reducing allocations, reducing dynamic dispatch, CoW, and more.

Robustness Under Stress

Nuke keeps memory usage under control. It is fully asynchronous and uses dedicated queues with limited concurrent task count. Nuke will even automatically rate limit the requests if necessary.

Elegant Builder API

Find the default API a bit boring? Try ImageTaskBuilder, a fun and convenient way to use Nuke.

ImagePipeline.shared.image(with: URL(string: "https://")!)
    .fill(width: 320)
    .blur(radius: 10)
    .priority(.high)
    .start { result in
        print(result)
    }

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.

Reactive Extensions

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: highResUrl).orEmpty)
        .subscribe(onNext: { imageView.image = $0.image })
        .disposed(by: disposeBag)
ImagePublisher introduces similar extensions for Combine.

Open on GitHub