Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 17, 2026·2 min de lecture

SDWebImage — Async Image Downloading with Cache for iOS

An asynchronous image downloading and caching library for iOS and macOS that provides UIImageView and SwiftUI categories for loading remote images with disk and memory caching.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
SDWebImage Overview
Commande CLI universelle
npx tokrepo install bba46d6c-520b-11f1-9bc6-00163e2b0d79

Introduction

SDWebImage is one of the longest-running image loading libraries in the iOS ecosystem. It provides asynchronous image downloading, multi-layer caching (memory and disk), and progressive image rendering. It supports UIKit, AppKit, and SwiftUI with a plugin architecture for extended image formats.

What SDWebImage Does

  • Downloads images asynchronously with prioritized concurrent operations
  • Caches images in a two-tier system (NSCache for memory, disk storage with expiration)
  • Supports progressive JPEG loading showing partial images during download
  • Provides animated image support for GIF, APNG, and WebP via plugins
  • Offers prefetching APIs to pre-download images before they appear on screen

Architecture Overview

The library is organized around SDWebImageManager which coordinates SDWebImageDownloader (network layer) and SDImageCache (storage layer). Each download creates an SDWebImageDownloaderOperation that can be cancelled or prioritized. Image transformations are applied via SDImageTransformer protocol, and custom format support is added through SDImageCoder plugins registered at startup.

Self-Hosting & Configuration

  • Install via Swift Package Manager, CocoaPods, or Carthage
  • Configure maximum memory cost and disk cache size through SDImageCacheConfig
  • Set default expiration with maxDiskAge (default 7 days)
  • Register custom coders for HEIF, AVIF, or WebP with SDImageCodersManager
  • Use SDWebImageDownloaderConfig to set max concurrent downloads and timeout

Key Features

  • View category extensions for UIImageView, NSImageView, UIButton, and SwiftUI
  • Image transformation pipeline with built-in rounded corners, blur, and tint
  • Disk cache uses file-based storage with URL-based filename hashing
  • Supports HTTP caching headers (ETag, Last-Modified) for conditional requests
  • Extensible architecture with 10+ official plugins for formats and loaders

Comparison with Similar Tools

  • Kingfisher — Swift-native with similar features; SDWebImage has longer history and Objective-C core
  • Alamofire Image — lighter but fewer caching features and no animated image support
  • Nuke — performance-focused with pipeline architecture; smaller plugin ecosystem
  • Glide (Android) — equivalent role on Android with similar caching strategies

FAQ

Q: Does SDWebImage support SwiftUI? A: Yes, the SDWebImageSwiftUI package provides WebImage and AnimatedImage views for SwiftUI.

Q: How do I clear the cache? A: Call SDImageCache.shared.clearMemory() and SDImageCache.shared.clearDisk() for full cache reset.

Q: Can it handle WebP images? A: Yes, install the SDWebImageWebPCoder plugin and register it at app startup.

Q: Is it compatible with Mac Catalyst? A: Yes, it fully supports Mac Catalyst, macOS via AppKit, and all Apple platforms.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.