Skip to content

SwiftCache v2.0.0

Latest

Choose a tag to compare

@SudhirGadhvi SudhirGadhvi released this 10 Nov 08:44
· 8 commits to main since this release
874a5fc

[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

  • SwiftCache is now an actor (thread-safe by design)
  • Primary API is now async/await (callback API still supported for backward compatibility)
  • UIImageView extension requires @MainActor context
  • 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 Sendable conformance, strict concurrency checking
  • Better Performance: Actors eliminate thread-hopping and GCD overhead

🔧 Changed

  • Actor-based architecture: SwiftCache, CacheLoaderChain, CacheAnalytics are now actors
  • No More await MainActor.run blocking: 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 .imageNotFound error 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.md with detailed explanation
  • Updated README with extensibility examples
  • Added macOS downscaling documentation