Since 2015

Powerful image loading system

Load images in SwiftUI, UIKit, and AppKit. Nuke handles memory and disk caching, processing, progressive decoding, animated images, and prefetching.

Nuke 14 is in beta, with animated images, diagnostics, and speedups of up to 5×. Read the release notes and the migration guide.

Testimonials

Simple to start, powerful when you need it

Display an image with one line of code, then customize every step of the pipeline under it, yourself or with an AI agent.

SwiftPM https://github.com/kean/Nuke
struct ContentView: View {
    let url: URL

    var body: some View {
        LazyImage(url: url) { state in
            if let image = state.image {
                image.resizable().scaledToFill()
            } else {
                Color.gray.opacity(0.2)
            }
        }
        .processors([.resize(width: 320)])
        .priority(.high)
    }
}

Everything an app needs from images

Ten years of real-world use went into the details, so the defaults are fast and the hard cases are handled.

Smooth Scrolling

Nuke does as little as possible on the main thread. Decoding, decompression, and processing run in the background, and the prefetcher loads what's next at a low priority, so scrolling stays smooth.

  • Prefetching with ImagePrefetcher and the collection view prefetching APIs
  • Downloads limited to a few at a time, with some always left free for what's on screen
  • Requests rate limited when someone scrolls really fast

Performance Guide →

Prefetching in the demo app, with its pipeline diagnostics

Animated Images

LazyImage and LazyImageView play GIF, APNG, animated WebP, and HEIC and AVIF sequences with no setup.

  • Parsed once and cached with the image, so a cell that scrolls back plays right away
  • Views share decoders and one frame pool with a fixed memory budget
  • Frames are decoded no larger than the view displays them
  • Playback modeled on WebKit, down to 30 Hz in Low Power Mode

Animated Images Guide →

A GIF in the demo app, with its playback diagnostics

Processors

Nuke applies the processors of a request in order, in the background, and caches the result, so the work is done once.

ImageRequest(url: url, processors: [ ])

Image Processing →

Row houses on a street in Hoboken at sunset

Select a processor in the code to turn it on or off

Diagnostics

Turn on isDiagnosticsEnabled, and every task records where the image came from and where its time went, down to the DNS lookup and the TLS handshake. Print the record for a timeline, or follow the pipeline in Instruments with signposts.

  • Caching

    A fast LRU memory cache, an aggressive LRU disk cache, and the HTTP disk cache.

  • Image Formats

    JPEG, PNG, HEIC, WebP, AVIF, and everything else Image I/O reads, plus custom decoders.

  • Progressive Decoding

    Show progressive JPEGs scan by scan as they download, so people see the image right away.

  • Thumbnails

    Decode and downsample a large image in one step, without ever decoding it at full size.

  • Coalescing & Priority

    Requests for the same image share one download, and a change of priority moves it in line.

  • Resumable Downloads

    A download that fails or gets cancelled picks up where it left off, using HTTP range requests.

  • Swift 6

    Async/await APIs and Sendable types, checked by the compiler in the strict concurrency mode.

  • Extensible

    Bring your own data loader, caches, decoders, or processors, or use the Alamofire plugin.

  • Video

    Play short videos in place of GIFs with NukeVideo, from a poster frame to a looping player.

Support Nuke

Nuke is free and open source, and I've been working on it since 2015. Sponsorship pays for the time it takes to keep it up to date and fix bugs.

Sponsor

Thanks to Proxyman for sponsoring Nuke