[2.0.0] - 2025-11-10
🎉 Major Rewrite - Swift Concurrency & Design Patterns
This is a major architectural overhaul with modern Swift Concurrency and design patterns.
⚠️ Breaking Changes
SwiftCacheis now anactor(thread-safe by design)- Primary API is now
async/await(callback API still supported for backward compatibility) UIImageViewextension requires@MainActorcontext- Removed all GCD (
DispatchQueue) usage in favor of Swift Concurrency
✨ New Features
- Chain of Responsibility Pattern: Clean three-tier fallback (Memory → Disk → Network)
- Strategy Pattern: Pluggable cache loaders - implement custom backends!
- macOS Downscaling Support: Image downscaling now works on macOS, not just iOS
- Custom Loader API:
setCustomLoaders(_:)allows complete customization - Swift 6 Ready: Full
Sendableconformance, strict concurrency checking - Better Performance: Actors eliminate thread-hopping and GCD overhead
🔧 Changed
- Actor-based architecture:
SwiftCache,CacheLoaderChain,CacheAnalyticsare now actors - No More
await MainActor.runblocking: Proper MainActor isolation - Improved async/await: No more wrapping callbacks with continuations (anti-pattern)
- Thread-safe CancellationToken: Uses structured concurrency with locks
- Better error handling: Added
.imageNotFounderror case
🚀 Improved
- macOS Support: First-class support with downscaling, documented in README
- Extensibility: Users can plug in Redis, S3, or any custom cache backend
- Testing: Easier to mock with strategy pattern
- Documentation: New architecture guide explaining all patterns
📚 Documentation
- Added
Documentation/architecture-guide.mdwith detailed explanation - Updated README with extensibility examples
- Added macOS downscaling documentation