swift-actor-persistence

Provide actor-based Swift repositories with in-memory cache and atomic file persistence.

3|2|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/agentmatters/mullai-bot --skill swift-actor-persistence-agentmatters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-actor-persistence
Source: https://github.com/agentmatters/mullai-bot/tree/main/src/Mullai.Skills/Skills/claude-code-everything/swift-actor-persistence
Command: npx skills add https://github.com/agentmatters/mullai-bot --skill swift-actor-persistence-agentmatters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Thread-safe data persistence in Swift is achieved by combining an in-memory cache with file-backed storage and actor isolation to eliminate data races.

Core Features & Use Cases

  • Actor-Based Repository: guarantees serialized access to shared mutable state without manual synchronization.
  • In-Memory Cache + File Persistence: fast reads from memory with durable, atomic writes to disk.
  • Generic & Safe: operates on any Codable & Identifiable model, ensuring type safety and reusability.
  • Use Case: local data storage for iOS/macOS apps, offline-first scenarios, and settings persistence with quick lookups.

Quick Start

Create a LocalRepository<T> for your model and start calling await repository.save(...) and await repository.loadAll() to persist and read data.

Frequently Asked Questions about swift-actor-persistence

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make Swift data persistence thread-safe for concurrent access?

You can persist Codable Swift models thread-safely by creating a generic LocalRepository<T> and calling await repository.save(model) or await repository.loadAll(), which routes operations through actor isolation to guarantee serialized access.

Can I use Swift actors for offline-first local data storage on iOS?

An actor-based repository handles any Swift model that conforms to Codable and Identifiable, ensuring type-safe persistence and reusability across different data types without requiring model-specific repository implementations.

What is the best way to persist shared Swift models without data races?

The best way to persist shared Swift models without data races is actor isolation, which serializes all read and write operations to the repository, automatically preventing concurrent access issues without manual locking mechanisms.

When should I use an actor-based repository instead of direct file writes in Swift?

The actor-based repository is limited to models conforming to Codable and Identifiable and uses atomic file writes for durability, making it unsuitable for complex relational databases or highly concurrent batch processing scenarios.