{"owner":"onevcat","repo":"Kingfisher","hasSkills":true,"totalSkillsCount":2,"totalTokensCount":2757,"categories":["project-spec","root-instruction"],"hasMcp":false,"mcpConfig":null,"found":["docs/architecture.md","AGENTS.md"],"skills":{"docs/architecture.md":"<!-- Generated: 2025-06-15 10:30:00 UTC -->\n\n# Kingfisher Architecture Documentation\n\n## High-Level System Organization\n\nKingfisher is a sophisticated image loading and caching library for Apple platforms, designed with a modular architecture that promotes separation of concerns and extensibility. At its core, the library employs a coordinator pattern where `KingfisherManager` serves as the central orchestrator, managing the flow between network operations, caching layers, and image processing pipelines. The architecture leverages protocol-oriented design principles, with all functionality exposed through a `.kf` namespace wrapper that provides a clean, chainable API surface.\n\nThe system is built on three fundamental pillars: downloading, caching, and processing. The `ImageDownloader` handles all network operations with support for authentication, retries, and progressive loading. The `ImageCache` implements a dual-layer caching strategy combining memory and disk storage for optimal performance. The `ImageProcessor` protocol enables a flexible transformation pipeline where multiple processors can be chained together. These components work in concert through a sophisticated options system (`KingfisherOptionsInfo`) that allows fine-grained control over every aspect of the image loading process.\n\nCross-platform compatibility is achieved through extensive use of conditional compilation and type aliases, allowing the same codebase to support iOS, macOS, tvOS, watchOS, and visionOS. The library provides both UIKit/AppKit extensions and dedicated SwiftUI components (`KFImage`, `KFAnimatedImage`), ensuring seamless integration regardless of the UI framework being used.\n\n## Component Map\n\n### Core Components\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **KingfisherManager** | `Sources/General/KingfisherManager.swift` | Central coordinator managing image retrieval, caching, and processing workflows |\n| **ImageDownloader** | `Sources/Networking/ImageDownloader.swift` | Handles all network operations for downloading images |\n| **ImageCache** | `Sources/Cache/ImageCache.swift` | Dual-layer caching system with memory and disk storage |\n| **ImageProcessor** | `Sources/Image/ImageProcessor.swift` | Protocol and implementations for image transformation pipeline |\n| **KF** | `Sources/General/KF.swift` | Builder pattern entry point for fluent API |\n| **Source** | `Sources/General/ImageSource/Source.swift` | Represents image data sources (network/provider) |\n| **Resource** | `Sources/General/ImageSource/Resource.swift` | Protocol for cacheable resources with key/URL |\n\n### Storage Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **MemoryStorage** | `Sources/Cache/MemoryStorage.swift` | In-memory cache implementation with LRU eviction |\n| **DiskStorage** | `Sources/Cache/DiskStorage.swift` | File-based cache with expiration and size limits |\n| **CacheSerializer** | `Sources/Cache/CacheSerializer.swift` | Handles image data serialization for cache storage |\n\n### Networking Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **SessionDelegate** | `Sources/Networking/SessionDelegate.swift` | URLSession delegate for download management |\n| **SessionDataTask** | `Sources/Networking/SessionDataTask.swift` | Wrapper for URLSessionDataTask with cancellation |\n| **ImagePrefetcher** | `Sources/Networking/ImagePrefetcher.swift` | Preloads images for improved performance |\n| **RequestModifier** | `Sources/Networking/RequestModifier.swift` | Protocol for modifying URL requests |\n| **RetryStrategy** | `Sources/Networking/RetryStrategy.swift` | Configurable retry logic for failed downloads |\n\n### UI Integration\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **ImageView+Kingfisher** | `Sources/Extensions/ImageView+Kingfisher.swift` | UIImageView/NSImageView extensions |\n| **KFImage** | `Sources/SwiftUI/KFImage.swift` | SwiftUI image component |\n| **KFAnimatedImage** | `Sources/SwiftUI/KFAnimatedImage.swift` | SwiftUI animated image support |\n| **AnimatedImageView** | `Sources/Views/AnimatedImageView.swift` | GIF animation support view |\n\n## Key Files\n\n### KingfisherManager.swift (Lines 107-420)\nThe heart of the library, containing:\n- `shared` singleton instance (line 113)\n- `retrieveImage()` main entry point (lines 196-210, 233-248)\n- Cache lookup logic (lines 400-403)\n- Download coordination (lines 415-418)\n- Retry and alternative source handling (lines 306-385)\n\n### ImageDownloader.swift (Lines 35-150)\nNetwork layer implementation:\n- `ImageLoadingResult` struct for download results (lines 36-58)\n- `DownloadTask` class for cancellable downloads (lines 65-102)\n- URLSession management and request handling\n\n### ImageCache.swift (Lines 52-200)\nCaching infrastructure:\n- `CacheType` enum defining cache levels (lines 52-72)\n- Memory and disk cache coordination\n- Cache key generation and expiration logic\n\n### KF.swift (Lines 50-100)\nBuilder pattern implementation:\n- Static factory methods for creating builders (lines 56-99)\n- Fluent API entry points for different source types\n\n### ImageProcessor.swift (Lines 37-100)\nProcessing pipeline:\n- `ImageProcessItem` enum for input types (lines 37-46)\n- `ImageProcessor` protocol definition (lines 49-76)\n- Processor chaining via `append()` (lines 85-95)\n\n### KingfisherOptionsInfo.swift (Lines 43-250)\nConfiguration system:\n- Option items enumeration with associated values\n- Cache, downloader, and processor configuration\n- Transition and placeholder settings\n\n## Data Flow\n\n### 1. Image Request Initiation\n\n```\nUIImageView.kf.setImage(with: url)\n    │\n    └─> ImageView+Kingfisher.swift (line 77-87)\n        │\n        └─> KingfisherManager.retrieveImage()\n            Sources/General/KingfisherManager.swift (line 196)\n```\n\n### 2. Cache Lookup\n\n```\nKingfisherManager.retrieveImage()\n    │\n    └─> retrieveImageFromCache() (line 400)\n        │\n        ├─> ImageCache.retrieveImage()\n        │   Sources/Cache/ImageCache.swift\n        │   │\n        │   ├─> MemoryStorage.value(forKey:)\n        │   │   Sources/Cache/MemoryStorage.swift\n        │   │\n        │   └─> DiskStorage.value(forKey:)\n        │       Sources/Cache/DiskStorage.swift\n        │\n        └─> [Cache Hit] → completionHandler(.success)\n            [Cache Miss] → Continue to download\n```\n\n### 3. Network Download\n\n```\nKingfisherManager.loadAndCacheImage() (line 415)\n    │\n    └─> ImageDownloader.downloadImage()\n        Sources/Networking/ImageDownloader.swift\n        │\n        ├─> SessionDelegate.downloadTask()\n        │   Sources/Networking/SessionDelegate.swift\n        │\n        └─> URLSession.dataTask()\n            │\n            └─> CompletionHandler with ImageLoadingResult\n```\n\n### 4. Image Processing\n\n```\nDownloaded Data\n    │\n    └─> ImageProcessor.process() (line 434)\n        Sources/Image/ImageProcessor.swift\n        │\n        ├─> DefaultImageProcessor (if none specified)\n        │\n        └─> Custom processors chain\n            │\n            └─> Processed KFCrossPlatformImage\n```\n\n### 5. Cache Storage\n\n```\nProcessed Image\n    │\n    └─> KingfisherManager.cacheImage() (line 459)\n        │\n        ├─> ImageCache.store() (line 482)\n        │   │\n        │   ├─> MemoryStorage.store()\n        │   │   In-memory cache with cost calculation\n        │   │\n        │   └─> DiskStorage.store()\n        │       File system with expiration\n        │\n        └─> completionHandler(.success(RetrieveImageResult))\n            │\n            └─> UI Update on main queue\n```\n\n### 6. Error Handling and Retry\n\n```\nDownload/Processing Error\n    │\n    └─> RetryStrategy.retry() (line 362)\n        Sources/Networking/RetryStrategy.swift\n        │\n        ├─> [Retry] → startNewRetrieveTask() (line 306)\n        │\n        └─> [No Retry] → Check alternative sources (line 334)\n            │\n            ├─> [Alternative exists] → Start new task\n            │\n            └─> [No alternatives] → completionHandler(.failure)\n```\n\nThis architecture enables Kingfisher to efficiently handle image loading with features like progressive downloading, multiple cache layers, flexible processing pipelines, and robust error handling, all while maintaining a clean and intuitive API surface for developers.","AGENTS.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Documentation\n\nYou can find the complete documentation for this project in the `docs/` directory. It describes the architecture, build system, development practices and more in detail the the project.\n\nThere is also a minimal, LLM-friendly version of the documentation in `README-LLM.md`. You can refer to the file if you need a quick overview of the project without going through the entire documentation.\n\n## Build and Development Commands\n\n### Primary Build System\nThis project uses **Fastlane** for primary build automation. Key commands:\n\n```bash\n# Install dependencies\nbundle install\n\n# Run all tests across platforms (iOS, macOS, tvOS, watchOS)\nbundle exec fastlane tests\n\n# Run specific platform tests\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Build for specific platform\nbundle exec fastlane build destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Lint CocoaPods spec and Swift Package Manager\nbundle exec fastlane lint\n```\n\n### Release Process\n```bash\n# Full release workflow (tests, linting, versioning, GitHub release, CocoaPods push)\nbundle exec fastlane release version:X.X.X\n```\n\n## Architecture Overview\n\n@docs/architecture.md\n\nKingfisher is a modular image loading and caching library with clear separation of concerns:\n\n### Core Components Flow\n1. **KingfisherManager** (`Sources/General/KingfisherManager.swift`) - Central coordinator\n2. **ImageDownloader** (`Sources/Networking/ImageDownloader.swift`) - Network layer\n3. **ImageCache** (`Sources/Cache/ImageCache.swift`) - Dual-layer caching (memory + disk)\n4. **ImageProcessor** (`Sources/Image/ImageProcessor.swift`) - Image transformation pipeline\n\n### Key Architectural Patterns\n- **Protocol-oriented design** with `KingfisherCompatible` protocol\n- **Namespace wrapper pattern** - All functionality accessed via `.kf` property\n- **Builder pattern** - `KF.url()...` method chaining\n- **Options pattern** - `KingfisherOptionsInfo` for configuration\n\n### Module Structure\n```\nSources/\n├── General/           # Core managers, options, data providers\n├── Networking/        # Download, prefetch, session management  \n├── Cache/            # Multi-layer caching system\n├── Image/            # Processing, filters, formats, transitions\n├── Extensions/       # UIKit/AppKit/SwiftUI integration\n├── SwiftUI/         # SwiftUI-specific components\n├── Utility/         # Helper utilities and extensions\n└── Views/           # Custom UI components\n```\n\n### Integration Points\n- **UIKit**: Extensions for `UIImageView`, `UIButton` via `.kf` namespace\n- **SwiftUI**: `KFImage` and `KFAnimatedImage` components\n- **Cross-platform**: Extensive conditional compilation for iOS/macOS/tvOS/watchOS/visionOS\n\n## Platform Support\n- **Platforms** (UIKit/AppKit and SwiftUI): iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 9.0+ / visionOS 1.0+\n- **Toolchain**: Xcode 26.0+ / Swift 6.2+ compiler (Swift 5 language mode by default; with Swift 6 strict concurrency support)\n\n## Testing\n\n### Test Structure\n- **Location**: `Tests/KingfisherTests/`\n- **Framework**: XCTest with custom `KingfisherTestHelper`\n- **Network mocking**: Uses Nocilla dependency for HTTP stubbing\n- **Test assets**: `dancing-banana.gif`, `single-frame.gif`\n\n### Running Tests\n```bash\n# All platforms (preferred)\nbundle exec fastlane tests\n\n# Single platform via destination\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 15\"\n```\n\n## Documentation System\n\nProvides a DocC-based documentation for framework users:\n\n- **DocC integration** with comprehensive tutorials and API docs\n- **Location**: `Sources/Documentation.docc/`\n- **Online**: Swift Package Index hosted documentation\n- **Tutorials**: Both UIKit and SwiftUI getting started guides available"},"files":{"docs/architecture.md":"<!-- Generated: 2025-06-15 10:30:00 UTC -->\n\n# Kingfisher Architecture Documentation\n\n## High-Level System Organization\n\nKingfisher is a sophisticated image loading and caching library for Apple platforms, designed with a modular architecture that promotes separation of concerns and extensibility. At its core, the library employs a coordinator pattern where `KingfisherManager` serves as the central orchestrator, managing the flow between network operations, caching layers, and image processing pipelines. The architecture leverages protocol-oriented design principles, with all functionality exposed through a `.kf` namespace wrapper that provides a clean, chainable API surface.\n\nThe system is built on three fundamental pillars: downloading, caching, and processing. The `ImageDownloader` handles all network operations with support for authentication, retries, and progressive loading. The `ImageCache` implements a dual-layer caching strategy combining memory and disk storage for optimal performance. The `ImageProcessor` protocol enables a flexible transformation pipeline where multiple processors can be chained together. These components work in concert through a sophisticated options system (`KingfisherOptionsInfo`) that allows fine-grained control over every aspect of the image loading process.\n\nCross-platform compatibility is achieved through extensive use of conditional compilation and type aliases, allowing the same codebase to support iOS, macOS, tvOS, watchOS, and visionOS. The library provides both UIKit/AppKit extensions and dedicated SwiftUI components (`KFImage`, `KFAnimatedImage`), ensuring seamless integration regardless of the UI framework being used.\n\n## Component Map\n\n### Core Components\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **KingfisherManager** | `Sources/General/KingfisherManager.swift` | Central coordinator managing image retrieval, caching, and processing workflows |\n| **ImageDownloader** | `Sources/Networking/ImageDownloader.swift` | Handles all network operations for downloading images |\n| **ImageCache** | `Sources/Cache/ImageCache.swift` | Dual-layer caching system with memory and disk storage |\n| **ImageProcessor** | `Sources/Image/ImageProcessor.swift` | Protocol and implementations for image transformation pipeline |\n| **KF** | `Sources/General/KF.swift` | Builder pattern entry point for fluent API |\n| **Source** | `Sources/General/ImageSource/Source.swift` | Represents image data sources (network/provider) |\n| **Resource** | `Sources/General/ImageSource/Resource.swift` | Protocol for cacheable resources with key/URL |\n\n### Storage Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **MemoryStorage** | `Sources/Cache/MemoryStorage.swift` | In-memory cache implementation with LRU eviction |\n| **DiskStorage** | `Sources/Cache/DiskStorage.swift` | File-based cache with expiration and size limits |\n| **CacheSerializer** | `Sources/Cache/CacheSerializer.swift` | Handles image data serialization for cache storage |\n\n### Networking Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **SessionDelegate** | `Sources/Networking/SessionDelegate.swift` | URLSession delegate for download management |\n| **SessionDataTask** | `Sources/Networking/SessionDataTask.swift` | Wrapper for URLSessionDataTask with cancellation |\n| **ImagePrefetcher** | `Sources/Networking/ImagePrefetcher.swift` | Preloads images for improved performance |\n| **RequestModifier** | `Sources/Networking/RequestModifier.swift` | Protocol for modifying URL requests |\n| **RetryStrategy** | `Sources/Networking/RetryStrategy.swift` | Configurable retry logic for failed downloads |\n\n### UI Integration\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **ImageView+Kingfisher** | `Sources/Extensions/ImageView+Kingfisher.swift` | UIImageView/NSImageView extensions |\n| **KFImage** | `Sources/SwiftUI/KFImage.swift` | SwiftUI image component |\n| **KFAnimatedImage** | `Sources/SwiftUI/KFAnimatedImage.swift` | SwiftUI animated image support |\n| **AnimatedImageView** | `Sources/Views/AnimatedImageView.swift` | GIF animation support view |\n\n## Key Files\n\n### KingfisherManager.swift (Lines 107-420)\nThe heart of the library, containing:\n- `shared` singleton instance (line 113)\n- `retrieveImage()` main entry point (lines 196-210, 233-248)\n- Cache lookup logic (lines 400-403)\n- Download coordination (lines 415-418)\n- Retry and alternative source handling (lines 306-385)\n\n### ImageDownloader.swift (Lines 35-150)\nNetwork layer implementation:\n- `ImageLoadingResult` struct for download results (lines 36-58)\n- `DownloadTask` class for cancellable downloads (lines 65-102)\n- URLSession management and request handling\n\n### ImageCache.swift (Lines 52-200)\nCaching infrastructure:\n- `CacheType` enum defining cache levels (lines 52-72)\n- Memory and disk cache coordination\n- Cache key generation and expiration logic\n\n### KF.swift (Lines 50-100)\nBuilder pattern implementation:\n- Static factory methods for creating builders (lines 56-99)\n- Fluent API entry points for different source types\n\n### ImageProcessor.swift (Lines 37-100)\nProcessing pipeline:\n- `ImageProcessItem` enum for input types (lines 37-46)\n- `ImageProcessor` protocol definition (lines 49-76)\n- Processor chaining via `append()` (lines 85-95)\n\n### KingfisherOptionsInfo.swift (Lines 43-250)\nConfiguration system:\n- Option items enumeration with associated values\n- Cache, downloader, and processor configuration\n- Transition and placeholder settings\n\n## Data Flow\n\n### 1. Image Request Initiation\n\n```\nUIImageView.kf.setImage(with: url)\n    │\n    └─> ImageView+Kingfisher.swift (line 77-87)\n        │\n        └─> KingfisherManager.retrieveImage()\n            Sources/General/KingfisherManager.swift (line 196)\n```\n\n### 2. Cache Lookup\n\n```\nKingfisherManager.retrieveImage()\n    │\n    └─> retrieveImageFromCache() (line 400)\n        │\n        ├─> ImageCache.retrieveImage()\n        │   Sources/Cache/ImageCache.swift\n        │   │\n        │   ├─> MemoryStorage.value(forKey:)\n        │   │   Sources/Cache/MemoryStorage.swift\n        │   │\n        │   └─> DiskStorage.value(forKey:)\n        │       Sources/Cache/DiskStorage.swift\n        │\n        └─> [Cache Hit] → completionHandler(.success)\n            [Cache Miss] → Continue to download\n```\n\n### 3. Network Download\n\n```\nKingfisherManager.loadAndCacheImage() (line 415)\n    │\n    └─> ImageDownloader.downloadImage()\n        Sources/Networking/ImageDownloader.swift\n        │\n        ├─> SessionDelegate.downloadTask()\n        │   Sources/Networking/SessionDelegate.swift\n        │\n        └─> URLSession.dataTask()\n            │\n            └─> CompletionHandler with ImageLoadingResult\n```\n\n### 4. Image Processing\n\n```\nDownloaded Data\n    │\n    └─> ImageProcessor.process() (line 434)\n        Sources/Image/ImageProcessor.swift\n        │\n        ├─> DefaultImageProcessor (if none specified)\n        │\n        └─> Custom processors chain\n            │\n            └─> Processed KFCrossPlatformImage\n```\n\n### 5. Cache Storage\n\n```\nProcessed Image\n    │\n    └─> KingfisherManager.cacheImage() (line 459)\n        │\n        ├─> ImageCache.store() (line 482)\n        │   │\n        │   ├─> MemoryStorage.store()\n        │   │   In-memory cache with cost calculation\n        │   │\n        │   └─> DiskStorage.store()\n        │       File system with expiration\n        │\n        └─> completionHandler(.success(RetrieveImageResult))\n            │\n            └─> UI Update on main queue\n```\n\n### 6. Error Handling and Retry\n\n```\nDownload/Processing Error\n    │\n    └─> RetryStrategy.retry() (line 362)\n        Sources/Networking/RetryStrategy.swift\n        │\n        ├─> [Retry] → startNewRetrieveTask() (line 306)\n        │\n        └─> [No Retry] → Check alternative sources (line 334)\n            │\n            ├─> [Alternative exists] → Start new task\n            │\n            └─> [No alternatives] → completionHandler(.failure)\n```\n\nThis architecture enables Kingfisher to efficiently handle image loading with features like progressive downloading, multiple cache layers, flexible processing pipelines, and robust error handling, all while maintaining a clean and intuitive API surface for developers.","AGENTS.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Documentation\n\nYou can find the complete documentation for this project in the `docs/` directory. It describes the architecture, build system, development practices and more in detail the the project.\n\nThere is also a minimal, LLM-friendly version of the documentation in `README-LLM.md`. You can refer to the file if you need a quick overview of the project without going through the entire documentation.\n\n## Build and Development Commands\n\n### Primary Build System\nThis project uses **Fastlane** for primary build automation. Key commands:\n\n```bash\n# Install dependencies\nbundle install\n\n# Run all tests across platforms (iOS, macOS, tvOS, watchOS)\nbundle exec fastlane tests\n\n# Run specific platform tests\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Build for specific platform\nbundle exec fastlane build destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Lint CocoaPods spec and Swift Package Manager\nbundle exec fastlane lint\n```\n\n### Release Process\n```bash\n# Full release workflow (tests, linting, versioning, GitHub release, CocoaPods push)\nbundle exec fastlane release version:X.X.X\n```\n\n## Architecture Overview\n\n@docs/architecture.md\n\nKingfisher is a modular image loading and caching library with clear separation of concerns:\n\n### Core Components Flow\n1. **KingfisherManager** (`Sources/General/KingfisherManager.swift`) - Central coordinator\n2. **ImageDownloader** (`Sources/Networking/ImageDownloader.swift`) - Network layer\n3. **ImageCache** (`Sources/Cache/ImageCache.swift`) - Dual-layer caching (memory + disk)\n4. **ImageProcessor** (`Sources/Image/ImageProcessor.swift`) - Image transformation pipeline\n\n### Key Architectural Patterns\n- **Protocol-oriented design** with `KingfisherCompatible` protocol\n- **Namespace wrapper pattern** - All functionality accessed via `.kf` property\n- **Builder pattern** - `KF.url()...` method chaining\n- **Options pattern** - `KingfisherOptionsInfo` for configuration\n\n### Module Structure\n```\nSources/\n├── General/           # Core managers, options, data providers\n├── Networking/        # Download, prefetch, session management  \n├── Cache/            # Multi-layer caching system\n├── Image/            # Processing, filters, formats, transitions\n├── Extensions/       # UIKit/AppKit/SwiftUI integration\n├── SwiftUI/         # SwiftUI-specific components\n├── Utility/         # Helper utilities and extensions\n└── Views/           # Custom UI components\n```\n\n### Integration Points\n- **UIKit**: Extensions for `UIImageView`, `UIButton` via `.kf` namespace\n- **SwiftUI**: `KFImage` and `KFAnimatedImage` components\n- **Cross-platform**: Extensive conditional compilation for iOS/macOS/tvOS/watchOS/visionOS\n\n## Platform Support\n- **Platforms** (UIKit/AppKit and SwiftUI): iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 9.0+ / visionOS 1.0+\n- **Toolchain**: Xcode 26.0+ / Swift 6.2+ compiler (Swift 5 language mode by default; with Swift 6 strict concurrency support)\n\n## Testing\n\n### Test Structure\n- **Location**: `Tests/KingfisherTests/`\n- **Framework**: XCTest with custom `KingfisherTestHelper`\n- **Network mocking**: Uses Nocilla dependency for HTTP stubbing\n- **Test assets**: `dancing-banana.gif`, `single-frame.gif`\n\n### Running Tests\n```bash\n# All platforms (preferred)\nbundle exec fastlane tests\n\n# Single platform via destination\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 15\"\n```\n\n## Documentation System\n\nProvides a DocC-based documentation for framework users:\n\n- **DocC integration** with comprehensive tutorials and API docs\n- **Location**: `Sources/Documentation.docc/`\n- **Online**: Swift Package Index hosted documentation\n- **Tutorials**: Both UIKit and SwiftUI getting started guides available"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/onevcat/Kingfisher/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Documentation\n\nYou can find the complete documentation for this project in the `docs/` directory. It describes the architecture, build system, development practices and more in detail the the project.\n\nThere is also a minimal, LLM-friendly version of the documentation in `README-LLM.md`. You can refer to the file if you need a quick overview of the project without going through the entire documentation.\n\n## Build and Development Commands\n\n### Primary Build System\nThis project uses **Fastlane** for primary build automation. Key commands:\n\n```bash\n# Install dependencies\nbundle install\n\n# Run all tests across platforms (iOS, macOS, tvOS, watchOS)\nbundle exec fastlane tests\n\n# Run specific platform tests\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Build for specific platform\nbundle exec fastlane build destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Lint CocoaPods spec and Swift Package Manager\nbundle exec fastlane lint\n```\n\n### Release Process\n```bash\n# Full release workflow (tests, linting, versioning, GitHub release, CocoaPods push)\nbundle exec fastlane release version:X.X.X\n```\n\n## Architecture Overview\n\n@docs/architecture.md\n\nKingfisher is a modular image loading and caching library with clear separation of concerns:\n\n### Core Components Flow\n1. **KingfisherManager** (`Sources/General/KingfisherManager.swift`) - Central coordinator\n2. **ImageDownloader** (`Sources/Networking/ImageDownloader.swift`) - Network layer\n3. **ImageCache** (`Sources/Cache/ImageCache.swift`) - Dual-layer caching (memory + disk)\n4. **ImageProcessor** (`Sources/Image/ImageProcessor.swift`) - Image transformation pipeline\n\n### Key Architectural Patterns\n- **Protocol-oriented design** with `KingfisherCompatible` protocol\n- **Namespace wrapper pattern** - All functionality accessed via `.kf` property\n- **Builder pattern** - `KF.url()...` method chaining\n- **Options pattern** - `KingfisherOptionsInfo` for configuration\n\n### Module Structure\n```\nSources/\n├── General/           # Core managers, options, data providers\n├── Networking/        # Download, prefetch, session management  \n├── Cache/            # Multi-layer caching system\n├── Image/            # Processing, filters, formats, transitions\n├── Extensions/       # UIKit/AppKit/SwiftUI integration\n├── SwiftUI/         # SwiftUI-specific components\n├── Utility/         # Helper utilities and extensions\n└── Views/           # Custom UI components\n```\n\n### Integration Points\n- **UIKit**: Extensions for `UIImageView`, `UIButton` via `.kf` namespace\n- **SwiftUI**: `KFImage` and `KFAnimatedImage` components\n- **Cross-platform**: Extensive conditional compilation for iOS/macOS/tvOS/watchOS/visionOS\n\n## Platform Support\n- **Platforms** (UIKit/AppKit and SwiftUI): iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 9.0+ / visionOS 1.0+\n- **Toolchain**: Xcode 26.0+ / Swift 6.2+ compiler (Swift 5 language mode by default; with Swift 6 strict concurrency support)\n\n## Testing\n\n### Test Structure\n- **Location**: `Tests/KingfisherTests/`\n- **Framework**: XCTest with custom `KingfisherTestHelper`\n- **Network mocking**: Uses Nocilla dependency for HTTP stubbing\n- **Test assets**: `dancing-banana.gif`, `single-frame.gif`\n\n### Running Tests\n```bash\n# All platforms (preferred)\nbundle exec fastlane tests\n\n# Single platform via destination\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 15\"\n```\n\n## Documentation System\n\nProvides a DocC-based documentation for framework users:\n\n- **DocC integration** with comprehensive tutorials and API docs\n- **Location**: `Sources/Documentation.docc/`\n- **Online**: Swift Package Index hosted documentation\n- **Tutorials**: Both UIKit and SwiftUI getting started guides available","isInternal":false,"tokens":894,"sizeBytes":3912},{"name":"architecture.md","path":"docs/architecture.md","rawUrl":"https://raw.githubusercontent.com/onevcat/Kingfisher/HEAD/docs/architecture.md","title":"docs - System Architecture & Module Boundaries","category":"project-spec","format":"markdown","content":"<!-- Generated: 2025-06-15 10:30:00 UTC -->\n\n# Kingfisher Architecture Documentation\n\n## High-Level System Organization\n\nKingfisher is a sophisticated image loading and caching library for Apple platforms, designed with a modular architecture that promotes separation of concerns and extensibility. At its core, the library employs a coordinator pattern where `KingfisherManager` serves as the central orchestrator, managing the flow between network operations, caching layers, and image processing pipelines. The architecture leverages protocol-oriented design principles, with all functionality exposed through a `.kf` namespace wrapper that provides a clean, chainable API surface.\n\nThe system is built on three fundamental pillars: downloading, caching, and processing. The `ImageDownloader` handles all network operations with support for authentication, retries, and progressive loading. The `ImageCache` implements a dual-layer caching strategy combining memory and disk storage for optimal performance. The `ImageProcessor` protocol enables a flexible transformation pipeline where multiple processors can be chained together. These components work in concert through a sophisticated options system (`KingfisherOptionsInfo`) that allows fine-grained control over every aspect of the image loading process.\n\nCross-platform compatibility is achieved through extensive use of conditional compilation and type aliases, allowing the same codebase to support iOS, macOS, tvOS, watchOS, and visionOS. The library provides both UIKit/AppKit extensions and dedicated SwiftUI components (`KFImage`, `KFAnimatedImage`), ensuring seamless integration regardless of the UI framework being used.\n\n## Component Map\n\n### Core Components\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **KingfisherManager** | `Sources/General/KingfisherManager.swift` | Central coordinator managing image retrieval, caching, and processing workflows |\n| **ImageDownloader** | `Sources/Networking/ImageDownloader.swift` | Handles all network operations for downloading images |\n| **ImageCache** | `Sources/Cache/ImageCache.swift` | Dual-layer caching system with memory and disk storage |\n| **ImageProcessor** | `Sources/Image/ImageProcessor.swift` | Protocol and implementations for image transformation pipeline |\n| **KF** | `Sources/General/KF.swift` | Builder pattern entry point for fluent API |\n| **Source** | `Sources/General/ImageSource/Source.swift` | Represents image data sources (network/provider) |\n| **Resource** | `Sources/General/ImageSource/Resource.swift` | Protocol for cacheable resources with key/URL |\n\n### Storage Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **MemoryStorage** | `Sources/Cache/MemoryStorage.swift` | In-memory cache implementation with LRU eviction |\n| **DiskStorage** | `Sources/Cache/DiskStorage.swift` | File-based cache with expiration and size limits |\n| **CacheSerializer** | `Sources/Cache/CacheSerializer.swift` | Handles image data serialization for cache storage |\n\n### Networking Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **SessionDelegate** | `Sources/Networking/SessionDelegate.swift` | URLSession delegate for download management |\n| **SessionDataTask** | `Sources/Networking/SessionDataTask.swift` | Wrapper for URLSessionDataTask with cancellation |\n| **ImagePrefetcher** | `Sources/Networking/ImagePrefetcher.swift` | Preloads images for improved performance |\n| **RequestModifier** | `Sources/Networking/RequestModifier.swift` | Protocol for modifying URL requests |\n| **RetryStrategy** | `Sources/Networking/RetryStrategy.swift` | Configurable retry logic for failed downloads |\n\n### UI Integration\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **ImageView+Kingfisher** | `Sources/Extensions/ImageView+Kingfisher.swift` | UIImageView/NSImageView extensions |\n| **KFImage** | `Sources/SwiftUI/KFImage.swift` | SwiftUI image component |\n| **KFAnimatedImage** | `Sources/SwiftUI/KFAnimatedImage.swift` | SwiftUI animated image support |\n| **AnimatedImageView** | `Sources/Views/AnimatedImageView.swift` | GIF animation support view |\n\n## Key Files\n\n### KingfisherManager.swift (Lines 107-420)\nThe heart of the library, containing:\n- `shared` singleton instance (line 113)\n- `retrieveImage()` main entry point (lines 196-210, 233-248)\n- Cache lookup logic (lines 400-403)\n- Download coordination (lines 415-418)\n- Retry and alternative source handling (lines 306-385)\n\n### ImageDownloader.swift (Lines 35-150)\nNetwork layer implementation:\n- `ImageLoadingResult` struct for download results (lines 36-58)\n- `DownloadTask` class for cancellable downloads (lines 65-102)\n- URLSession management and request handling\n\n### ImageCache.swift (Lines 52-200)\nCaching infrastructure:\n- `CacheType` enum defining cache levels (lines 52-72)\n- Memory and disk cache coordination\n- Cache key generation and expiration logic\n\n### KF.swift (Lines 50-100)\nBuilder pattern implementation:\n- Static factory methods for creating builders (lines 56-99)\n- Fluent API entry points for different source types\n\n### ImageProcessor.swift (Lines 37-100)\nProcessing pipeline:\n- `ImageProcessItem` enum for input types (lines 37-46)\n- `ImageProcessor` protocol definition (lines 49-76)\n- Processor chaining via `append()` (lines 85-95)\n\n### KingfisherOptionsInfo.swift (Lines 43-250)\nConfiguration system:\n- Option items enumeration with associated values\n- Cache, downloader, and processor configuration\n- Transition and placeholder settings\n\n## Data Flow\n\n### 1. Image Request Initiation\n\n```\nUIImageView.kf.setImage(with: url)\n    │\n    └─> ImageView+Kingfisher.swift (line 77-87)\n        │\n        └─> KingfisherManager.retrieveImage()\n            Sources/General/KingfisherManager.swift (line 196)\n```\n\n### 2. Cache Lookup\n\n```\nKingfisherManager.retrieveImage()\n    │\n    └─> retrieveImageFromCache() (line 400)\n        │\n        ├─> ImageCache.retrieveImage()\n        │   Sources/Cache/ImageCache.swift\n        │   │\n        │   ├─> MemoryStorage.value(forKey:)\n        │   │   Sources/Cache/MemoryStorage.swift\n        │   │\n        │   └─> DiskStorage.value(forKey:)\n        │       Sources/Cache/DiskStorage.swift\n        │\n        └─> [Cache Hit] → completionHandler(.success)\n            [Cache Miss] → Continue to download\n```\n\n### 3. Network Download\n\n```\nKingfisherManager.loadAndCacheImage() (line 415)\n    │\n    └─> ImageDownloader.downloadImage()\n        Sources/Networking/ImageDownloader.swift\n        │\n        ├─> SessionDelegate.downloadTask()\n        │   Sources/Networking/SessionDelegate.swift\n        │\n        └─> URLSession.dataTask()\n            │\n            └─> CompletionHandler with ImageLoadingResult\n```\n\n### 4. Image Processing\n\n```\nDownloaded Data\n    │\n    └─> ImageProcessor.process() (line 434)\n        Sources/Image/ImageProcessor.swift\n        │\n        ├─> DefaultImageProcessor (if none specified)\n        │\n        └─> Custom processors chain\n            │\n            └─> Processed KFCrossPlatformImage\n```\n\n### 5. Cache Storage\n\n```\nProcessed Image\n    │\n    └─> KingfisherManager.cacheImage() (line 459)\n        │\n        ├─> ImageCache.store() (line 482)\n        │   │\n        │   ├─> MemoryStorage.store()\n        │   │   In-memory cache with cost calculation\n        │   │\n        │   └─> DiskStorage.store()\n        │       File system with expiration\n        │\n        └─> completionHandler(.success(RetrieveImageResult))\n            │\n            └─> UI Update on main queue\n```\n\n### 6. Error Handling and Retry\n\n```\nDownload/Processing Error\n    │\n    └─> RetryStrategy.retry() (line 362)\n        Sources/Networking/RetryStrategy.swift\n        │\n        ├─> [Retry] → startNewRetrieveTask() (line 306)\n        │\n        └─> [No Retry] → Check alternative sources (line 334)\n            │\n            ├─> [Alternative exists] → Start new task\n            │\n            └─> [No alternatives] → completionHandler(.failure)\n```\n\nThis architecture enables Kingfisher to efficiently handle image loading with features like progressive downloading, multiple cache layers, flexible processing pipelines, and robust error handling, all while maintaining a clean and intuitive API surface for developers.","isInternal":false,"tokens":1863,"sizeBytes":8472}],"systemPromptSnippet":"<yakaai_skills repo=\"onevcat/Kingfisher\">\n<!-- File: AGENTS.md (Tokens: ~894 | Category: root-instruction) -->\n# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Documentation\n\nYou can find the complete documentation for this project in the `docs/` directory. It describes the architecture, build system, development practices and more in detail the the project.\n\nThere is also a minimal, LLM-friendly version of the documentation in `README-LLM.md`. You can refer to the file if you need a quick overview of the project without going through the entire documentation.\n\n## Build and Development Commands\n\n### Primary Build System\nThis project uses **Fastlane** for primary build automation. Key commands:\n\n```bash\n# Install dependencies\nbundle install\n\n# Run all tests across platforms (iOS, macOS, tvOS, watchOS)\nbundle exec fastlane tests\n\n# Run specific platform tests\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Build for specific platform\nbundle exec fastlane build destination:\"platform=iOS Simulator,name=iPhone 16\"\n\n# Lint CocoaPods spec and Swift Package Manager\nbundle exec fastlane lint\n```\n\n### Release Process\n```bash\n# Full release workflow (tests, linting, versioning, GitHub release, CocoaPods push)\nbundle exec fastlane release version:X.X.X\n```\n\n## Architecture Overview\n\n@docs/architecture.md\n\nKingfisher is a modular image loading and caching library with clear separation of concerns:\n\n### Core Components Flow\n1. **KingfisherManager** (`Sources/General/KingfisherManager.swift`) - Central coordinator\n2. **ImageDownloader** (`Sources/Networking/ImageDownloader.swift`) - Network layer\n3. **ImageCache** (`Sources/Cache/ImageCache.swift`) - Dual-layer caching (memory + disk)\n4. **ImageProcessor** (`Sources/Image/ImageProcessor.swift`) - Image transformation pipeline\n\n### Key Architectural Patterns\n- **Protocol-oriented design** with `KingfisherCompatible` protocol\n- **Namespace wrapper pattern** - All functionality accessed via `.kf` property\n- **Builder pattern** - `KF.url()...` method chaining\n- **Options pattern** - `KingfisherOptionsInfo` for configuration\n\n### Module Structure\n```\nSources/\n├── General/           # Core managers, options, data providers\n├── Networking/        # Download, prefetch, session management  \n├── Cache/            # Multi-layer caching system\n├── Image/            # Processing, filters, formats, transitions\n├── Extensions/       # UIKit/AppKit/SwiftUI integration\n├── SwiftUI/         # SwiftUI-specific components\n├── Utility/         # Helper utilities and extensions\n└── Views/           # Custom UI components\n```\n\n### Integration Points\n- **UIKit**: Extensions for `UIImageView`, `UIButton` via `.kf` namespace\n- **SwiftUI**: `KFImage` and `KFAnimatedImage` components\n- **Cross-platform**: Extensive conditional compilation for iOS/macOS/tvOS/watchOS/visionOS\n\n## Platform Support\n- **Platforms** (UIKit/AppKit and SwiftUI): iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 9.0+ / visionOS 1.0+\n- **Toolchain**: Xcode 26.0+ / Swift 6.2+ compiler (Swift 5 language mode by default; with Swift 6 strict concurrency support)\n\n## Testing\n\n### Test Structure\n- **Location**: `Tests/KingfisherTests/`\n- **Framework**: XCTest with custom `KingfisherTestHelper`\n- **Network mocking**: Uses Nocilla dependency for HTTP stubbing\n- **Test assets**: `dancing-banana.gif`, `single-frame.gif`\n\n### Running Tests\n```bash\n# All platforms (preferred)\nbundle exec fastlane tests\n\n# Single platform via destination\nbundle exec fastlane test destination:\"platform=iOS Simulator,name=iPhone 15\"\n```\n\n## Documentation System\n\nProvides a DocC-based documentation for framework users:\n\n- **DocC integration** with comprehensive tutorials and API docs\n- **Location**: `Sources/Documentation.docc/`\n- **Online**: Swift Package Index hosted documentation\n- **Tutorials**: Both UIKit and SwiftUI getting started guides available\n\n<!-- File: docs/architecture.md (Tokens: ~1863 | Category: project-spec) -->\n<!-- Generated: 2025-06-15 10:30:00 UTC -->\n\n# Kingfisher Architecture Documentation\n\n## High-Level System Organization\n\nKingfisher is a sophisticated image loading and caching library for Apple platforms, designed with a modular architecture that promotes separation of concerns and extensibility. At its core, the library employs a coordinator pattern where `KingfisherManager` serves as the central orchestrator, managing the flow between network operations, caching layers, and image processing pipelines. The architecture leverages protocol-oriented design principles, with all functionality exposed through a `.kf` namespace wrapper that provides a clean, chainable API surface.\n\nThe system is built on three fundamental pillars: downloading, caching, and processing. The `ImageDownloader` handles all network operations with support for authentication, retries, and progressive loading. The `ImageCache` implements a dual-layer caching strategy combining memory and disk storage for optimal performance. The `ImageProcessor` protocol enables a flexible transformation pipeline where multiple processors can be chained together. These components work in concert through a sophisticated options system (`KingfisherOptionsInfo`) that allows fine-grained control over every aspect of the image loading process.\n\nCross-platform compatibility is achieved through extensive use of conditional compilation and type aliases, allowing the same codebase to support iOS, macOS, tvOS, watchOS, and visionOS. The library provides both UIKit/AppKit extensions and dedicated SwiftUI components (`KFImage`, `KFAnimatedImage`), ensuring seamless integration regardless of the UI framework being used.\n\n## Component Map\n\n### Core Components\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **KingfisherManager** | `Sources/General/KingfisherManager.swift` | Central coordinator managing image retrieval, caching, and processing workflows |\n| **ImageDownloader** | `Sources/Networking/ImageDownloader.swift` | Handles all network operations for downloading images |\n| **ImageCache** | `Sources/Cache/ImageCache.swift` | Dual-layer caching system with memory and disk storage |\n| **ImageProcessor** | `Sources/Image/ImageProcessor.swift` | Protocol and implementations for image transformation pipeline |\n| **KF** | `Sources/General/KF.swift` | Builder pattern entry point for fluent API |\n| **Source** | `Sources/General/ImageSource/Source.swift` | Represents image data sources (network/provider) |\n| **Resource** | `Sources/General/ImageSource/Resource.swift` | Protocol for cacheable resources with key/URL |\n\n### Storage Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **MemoryStorage** | `Sources/Cache/MemoryStorage.swift` | In-memory cache implementation with LRU eviction |\n| **DiskStorage** | `Sources/Cache/DiskStorage.swift` | File-based cache with expiration and size limits |\n| **CacheSerializer** | `Sources/Cache/CacheSerializer.swift` | Handles image data serialization for cache storage |\n\n### Networking Layer\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **SessionDelegate** | `Sources/Networking/SessionDelegate.swift` | URLSession delegate for download management |\n| **SessionDataTask** | `Sources/Networking/SessionDataTask.swift` | Wrapper for URLSessionDataTask with cancellation |\n| **ImagePrefetcher** | `Sources/Networking/ImagePrefetcher.swift` | Preloads images for improved performance |\n| **RequestModifier** | `Sources/Networking/RequestModifier.swift` | Protocol for modifying URL requests |\n| **RetryStrategy** | `Sources/Networking/RetryStrategy.swift` | Configurable retry logic for failed downloads |\n\n### UI Integration\n\n| Component | Location | Purpose |\n|-----------|----------|---------|\n| **ImageView+Kingfisher** | `Sources/Extensions/ImageView+Kingfisher.swift` | UIImageView/NSImageView extensions |\n| **KFImage** | `Sources/SwiftUI/KFImage.swift` | SwiftUI image component |\n| **KFAnimatedImage** | `Sources/SwiftUI/KFAnimatedImage.swift` | SwiftUI animated image support |\n| **AnimatedImageView** | `Sources/Views/AnimatedImageView.swift` | GIF animation support view |\n\n## Key Files\n\n### KingfisherManager.swift (Lines 107-420)\nThe heart of the library, containing:\n- `shared` singleton instance (line 113)\n- `retrieveImage()` main entry point (lines 196-210, 233-248)\n- Cache lookup logic (lines 400-403)\n- Download coordination (lines 415-418)\n- Retry and alternative source handling (lines 306-385)\n\n### ImageDownloader.swift (Lines 35-150)\nNetwork layer implementation:\n- `ImageLoadingResult` struct for download results (lines 36-58)\n- `DownloadTask` class for cancellable downloads (lines 65-102)\n- URLSession management and request handling\n\n### ImageCache.swift (Lines 52-200)\nCaching infrastructure:\n- `CacheType` enum defining cache levels (lines 52-72)\n- Memory and disk cache coordination\n- Cache key generation and expiration logic\n\n### KF.swift (Lines 50-100)\nBuilder pattern implementation:\n- Static factory methods for creating builders (lines 56-99)\n- Fluent API entry points for different source types\n\n### ImageProcessor.swift (Lines 37-100)\nProcessing pipeline:\n- `ImageProcessItem` enum for input types (lines 37-46)\n- `ImageProcessor` protocol definition (lines 49-76)\n- Processor chaining via `append()` (lines 85-95)\n\n### KingfisherOptionsInfo.swift (Lines 43-250)\nConfiguration system:\n- Option items enumeration with associated values\n- Cache, downloader, and processor configuration\n- Transition and placeholder settings\n\n## Data Flow\n\n### 1. Image Request Initiation\n\n```\nUIImageView.kf.setImage(with: url)\n    │\n    └─> ImageView+Kingfisher.swift (line 77-87)\n        │\n        └─> KingfisherManager.retrieveImage()\n            Sources/General/KingfisherManager.swift (line 196)\n```\n\n### 2. Cache Lookup\n\n```\nKingfisherManager.retrieveImage()\n    │\n    └─> retrieveImageFromCache() (line 400)\n        │\n        ├─> ImageCache.retrieveImage()\n        │   Sources/Cache/ImageCache.swift\n        │   │\n        │   ├─> MemoryStorage.value(forKey:)\n        │   │   Sources/Cache/MemoryStorage.swift\n        │   │\n        │   └─> DiskStorage.value(forKey:)\n        │       Sources/Cache/DiskStorage.swift\n        │\n        └─> [Cache Hit] → completionHandler(.success)\n            [Cache Miss] → Continue to download\n```\n\n### 3. Network Download\n\n```\nKingfisherManager.loadAndCacheImage() (line 415)\n    │\n    └─> ImageDownloader.downloadImage()\n        Sources/Networking/ImageDownloader.swift\n        │\n        ├─> SessionDelegate.downloadTask()\n        │   Sources/Networking/SessionDelegate.swift\n        │\n        └─> URLSession.dataTask()\n            │\n            └─> CompletionHandler with ImageLoadingResult\n```\n\n### 4. Image Processing\n\n```\nDownloaded Data\n    │\n    └─> ImageProcessor.process() (line 434)\n        Sources/Image/ImageProcessor.swift\n        │\n        ├─> DefaultImageProcessor (if none specified)\n        │\n        └─> Custom processors chain\n            │\n            └─> Processed KFCrossPlatformImage\n```\n\n### 5. Cache Storage\n\n```\nProcessed Image\n    │\n    └─> KingfisherManager.cacheImage() (line 459)\n        │\n        ├─> ImageCache.store() (line 482)\n        │   │\n        │   ├─> MemoryStorage.store()\n        │   │   In-memory cache with cost calculation\n        │   │\n        │   └─> DiskStorage.store()\n        │       File system with expiration\n        │\n        └─> completionHandler(.success(RetrieveImageResult))\n            │\n            └─> UI Update on main queue\n```\n\n### 6. Error Handling and Retry\n\n```\nDownload/Processing Error\n    │\n    └─> RetryStrategy.retry() (line 362)\n        Sources/Networking/RetryStrategy.swift\n        │\n        ├─> [Retry] → startNewRetrieveTask() (line 306)\n        │\n        └─> [No Retry] → Check alternative sources (line 334)\n            │\n            ├─> [Alternative exists] → Start new task\n            │\n            └─> [No alternatives] → completionHandler(.failure)\n```\n\nThis architecture enables Kingfisher to efficiently handle image loading with features like progressive downloading, multiple cache layers, flexible processing pipelines, and robust error handling, all while maintaining a clean and intuitive API surface for developers.\n</yakaai_skills>"}