What problem does it solve?
Provides a simple, compiler-enforced way to eliminate data races and synchronize access to local mutable state in Swift applications by using actor-based repositories instead of manual locks or DispatchQueues. It makes concurrent reads fast via an in-memory cache and ensures durable writes with atomic file persistence, reducing concurrency bugs and crash-corruption risks.
Core Features & Use Cases
- Actor-based repository pattern for serialized, thread-safe access to shared model data.
- In-memory caching combined with file-backed persistence for fast reads and durable storage.
- Generic support for types conforming to Codable and Identifiable, suitable for SPM packages, app extensions, and app groups.
- Practical for offline-first apps, local repositories without SwiftData, and sharing state with widgets via App Groups.
Quick Start
Instantiate a LocalRepository for your Codable & Identifiable model, then use await repository.save(item) and await repository.loadAll() for thread-safe writes and reads.