image-loading

Cache and load images in SwiftUI apps with memory and disk caches.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/ano4l/SiteRent --skill image-loading-ano4l
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: image-loading
Source: https://github.com/ano4l/SiteRent/tree/main/skills/generators/image-loading
Command: npx skills add https://github.com/ano4l/SiteRent --skill image-loading-ano4l

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates a production image loading pipeline with NSCache memory cache, LRU disk cache, request deduplication, image processing, and a drop-in CachedAsyncImage SwiftUI view to replace AsyncImage.

Core Features & Use Cases

  • Memory cache via NSCache with automatic eviction
  • Disk cache with LRU eviction and optional processing
  • Deduplicated concurrent downloads to save bandwidth
  • Optional image processing (resize, thumbnail) for different display sizes
  • Drop-in SwiftUI view CachedAsyncImage for easy reuse

Quick Start

Use CachedAsyncImage in your SwiftUI views by providing a URL to automatically cache and display images.

Frequently Asked Questions about image-loading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement efficient image loading and caching in SwiftUI?

Efficient image loading in SwiftUI requires an image pipeline combining NSCache memory caching, LRU disk caching, and deduplicated downloads. This minimizes bandwidth usage, prevents redundant network requests, and provides offline support for lists and grids.

How do I replace AsyncImage with a cached SwiftUI image view?

You can replace AsyncImage by using a drop-in CachedAsyncImage SwiftUI component, providing a URL to automatically handle memory caching, disk caching, and deduplicated downloads for display.

What's the best way to prevent duplicate image downloads in SwiftUI lists and grids?

Preventing duplicate image downloads requires an ImageDownloader with deduplication logic. This ensures concurrent requests for the same URL download only once, saving bandwidth and improving scrolling performance in lists and grids.

Can I use an NSCache memory cache and disk cache for offline image loading on iOS and macOS?

Yes, you can use an image pipeline combining a MemoryImageCache using NSCache and a DiskImageCache with LRU eviction. This layered caching strategy provides offline support for iOS and macOS SwiftUI applications.

How do I resize or thumbnail images before displaying them in SwiftUI?

To resize or thumbnail images before display, use an optional ImageProcessor within the image loading pipeline. This processes images for different display sizes after download, reducing memory overhead.