Swift Actor Persistence
Thread-safe data persistence in Swift with actors: an in-memory cache plus file-backed storage, data races eliminated by the compiler, with a generic Codable repository.
- What
- Thread-safe data persistence in Swift with actors: an in-memory cache plus file-backed storage, data races eliminated by the compiler, with a generic Codable repository.
- Cost
- Free
- Needs
- Use "Swift Actor Persistence" with your Muse.
- Install
- Copy the installer prompt below into your Muse — your agent does the rest.
Curated by Skill Harbor: a Swift concurrency pattern that turns thread-safe persistence into a compiler guarantee. The core is a generic actor-based repository: an in-memory dictionary cache for O(1) reads, file-backed JSON storage with atomic writes for durability, all wrapped in a Swift actor so serialized access is enforced by the compiler instead of locks or dispatch queues. The repository is generic over Codable and Identifiable types, with save, delete, find, and loadAll operations. Initialization loads synchronously before actor isolation activates, avoiding the async-init trap. The pattern extends to offline-first apps: local storage as the source of truth, background sync when the network returns, conflict resolution strategies. Also covered: when actors are not enough (large datasets needing SQLite or Core Data), migration from legacy lock-based code, and testing actors with async test functions. By @affaan-m, listed here with credit to its creator. From the affaan-m/ECC repository (MIT). Honest caveats: JSON file storage fits small to medium datasets; for large data or complex queries use a real database; actor isolation adds async boundaries, design your call sites accordingly. Skill Harbor never reviews the code, review it yourself before use.
Version:
Install
Copy the install package below, then paste it into MuseThe install prompt below already includes the vetting steps: your agent follows the community checklist before installing anything with executable code. Want more?
Use "Swift Actor Persistence" with your Muse. Prerequisites: none to install. Pure guidance; a Swift 5.5+ project helps (actors require Swift 5.5). 1. Open the skill: https://github.com/affaan-m/ECC/blob/main/skills/swift-actor-persistence/SKILL.md and copy the full SKILL.md text. 2. Paste it into a chat with Muse and add: "Build a thread-safe persistence layer for [model]" or "Migrate my lock-based store to actors." 3. Work through the repository pattern with Muse, then extend to sync and conflict handling if needed. Tip: start from the generic LocalRepository and specialize it; do not hand-roll your own actor plumbing first. Safety: a skill is plain-text instructions; it runs nothing by itself. Review generated code before shipping.
Saved to your recent installs. Find it anytime on /connect.
Questions
How do I install a build?
Every product page includes a copy-paste install prompt. Paste it into your Muse and it sets the build up for you — no manual configuration.
Where does my money go?
Straight to the seller. Skill Harbor never processes payments: checkout happens on the seller’s own page, usually Stripe.
What does the ✓ next to a creator’s name mean?
It means we confirmed the identity of the person behind the listing. It says nothing about the code itself — always check a build before installing it.