image-loading_skill

This skill builds a production image loading pipeline with memory and disk caching, deduplication, and a drop-in CachedAsyncImage view for SwiftUI.
  • Swift

56

GitHub Stars

3

Bundled Files

2 months ago

Catalog Refreshed

3 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill rshankras/claude-code-apple-skills --skill image-loading

  • image-loading-patterns.md10.4 KB
  • SKILL.md6.4 KB
  • templates.md18.4 KB

Overview

This skill generates a production-ready image loading pipeline for Swift apps, including memory and disk caching, request deduplication, optional image processing, and a drop-in CachedAsyncImage SwiftUI view. It targets modern Swift and platform APIs to replace AsyncImage with a cached, performant alternative. The output includes configurable cache sizes, LRU disk behavior, and optional prefetching and processing components.

How this skill works

I create a small set of Swift components that work together: a memory cache (NSCache) and an LRU disk cache, an actor-based downloader that deduplicates concurrent requests and supports cancellation, an image pipeline that orchestrates cache → download → process → store, and a CachedAsyncImage view for SwiftUI. Optional modules include an ImageProcessor for resizing/thumbnails and an ImagePrefetcher to warm caches for lists. The pipeline uses platform abstractions so it can target iOS (UIImage), macOS (NSImage), or both via a typealias.

When to use it

  • You need image caching to avoid repeated network downloads
  • You want a drop-in replacement for AsyncImage with caching and cancellation
  • You need request deduplication to prevent parallel downloads for the same URL
  • You want thumbnail generation or resizing to reduce memory use
  • You need prefetching for collection views or lists

Best practices

  • Choose medium cache sizes for general apps; increase only if profiling shows need
  • Enable image processing (downscale) for large source images to save memory and disk
  • Use the prefetcher for long lists but limit concurrency and buffer size
  • Respect cached expirations and provide a clear cache invalidation strategy
  • Test deduplication and cancellation paths with mocked downloaders in unit tests

Example use cases

  • Replace AsyncImage in a profile list to add caching and faster scrolling
  • Add thumbnail generation for a photo gallery to reduce memory and disk usage
  • Prefetch images for an infinite-scrolling feed to improve perceived performance
  • Use CachedAsyncImage in a chat app for avatars with quick cache hits and low bandwidth
  • Run unit tests that assert cache hits avoid network downloads and deduplicate concurrent requests

FAQ

It supports iOS and macOS; generation can produce platform-specific code or a cross-platform typealias for UIImage/NSImage.

Will this replace existing image libraries?

I detect third-party loaders and will ask whether you want to replace or keep them; if you keep them, I provide integration recommendations instead of overwriting.

How do I choose cache sizes?

Options are Small/Medium/Large. Medium is a balanced default; choose larger sizes only after profiling memory and disk usage.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational