image-loading

Cache and deduplicate image loading with NSCache, LRU disk cache, and CachedAsyncImage for SwiftUI.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates a production-ready image loading pipeline with memory/disk caching, request deduplication, optional processing, and a drop-in CachedAsyncImage SwiftUI view to replace AsyncImage in UI lists.

Core Features & Use Cases

  • In-memory NSCache for fast hits and automatic eviction under memory pressure.
  • LRU disk cache with expiration to support offline access and reduce network usage.
  • Deduplicated concurrent requests to ensure a single download for the same URL.
  • Optional image processing (resize, thumbnail) to optimize memory and transfer sizes.
  • Drop-in CachedAsyncImage SwiftUI view for seamless replacement in lists and grids.

Quick Start

Integrate CachedAsyncImage into a SwiftUI list to start caching and deduplicating image requests.

Frequently Asked Questions about image-loading

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

FAQPage Schema
How do I load images efficiently in SwiftUI lists without duplicate network requests?

Efficient image loading in SwiftUI lists is achieved by combining an NSCache memory cache, an LRU disk cache, and an actor-based downloader to deduplicate concurrent network requests for the same URL, preventing redundant downloads.

Can I replace AsyncImage with a drop-in SwiftUI view for offline image caching?

Yes, you can replace AsyncImage with a drop-in CachedAsyncImage SwiftUI view that utilizes memory and disk caches to keep images available offline and load them quickly in list-heavy user interfaces.

What's the best way to cache and resize images for iOS and macOS apps?

The best way to cache and resize images for iOS and macOS apps is using a pipeline with an NSCache-based memory cache, an LRU disk cache, and optional image processing to generate thumbnails and optimize memory usage.

Why does NSCache automatically evict images under memory pressure in an image loading pipeline?

NSCache automatically evicts images under memory pressure because it is designed to manage memory automatically, removing cached objects when the system encounters low-memory situations to prevent app crashes in production-grade environments.

Does request deduplication work with disk caching for offline image access?

Yes, request deduplication works alongside disk caching by ensuring a single download per URL, while the LRU disk cache with expiration stores the downloaded images to support offline access and reduce subsequent network usage.