BigHugger
sk Skill · affaan-m

swift-actor-persistence

Thread-safe data persistence in Swift using actors — in-memory cache with file-backed storage, eliminating data races by design. Use when persisting data in Swift and a data race or thread-safety problem needs designing out.

installs 8w
1,720
30-day movement
starts with the next reading
Related entries
6
Connections
0
swiftJavaScript

A SKILL.md that teaches thread-safe data persistence in Swift using actors, combining an in-memory cache with file-backed storage. It covers an actor-based repository pattern, usage with async calls, design decisions, best practices like Sendable types, and anti-patterns to avoid.

Reach for it when building a Swift persistence layer where data races or manual synchronization need to be designed out.

Use it to

  • Build an actor-based repository for local storage
  • Persist user data or settings in iOS/macOS apps
  • Design offline-first storage that syncs later
  • Replace DispatchQueue/NSLock patterns with actors
  • Wire an actor-backed store to an @Observable ViewModel

For Swift developers using Swift 5.5+ concurrency

Host repository
affaan-m/ECC
Installs, lifetime
2,900
Installs, 8 weeks
1,720
Host stars
261k
Host language
JavaScript
topicsswiftactorspersistencethread-safetyconcurrencyios