swift-data

Define SwiftData @Model entities and configure ModelContainer for iOS MVVM-C apps.

193|17|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/pproenca/dot-skills --skill swift-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-data
Source: https://github.com/pproenca/dot-skills/tree/main/skills/.experimental/swift-data
Command: npx skills add https://github.com/pproenca/dot-skills --skill swift-data

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on using SwiftData for data modeling, persistence, state management, and synchronization in modular MVVM-C applications, ensuring data integrity and efficient app architecture.

Core Features & Use Cases

  • Data Modeling: Best practices for defining @Model entities and mapping them to domain structs.
  • Persistence Setup: Correct configuration of ModelContainer and ModelContext for reliable data storage.
  • CRUD Operations: Implementing efficient insert, update, and delete patterns.
  • Sync & Networking: Strategies for offline-first data synchronization and API integration.
  • Schema Management: Planning and executing schema migrations safely.
  • Use Case: Building a complex iOS application that requires robust local data storage, offline capabilities, and seamless synchronization with a backend API, while adhering to a clean, modular architecture.

Quick Start

Review the SwiftData best practices for defining @Model entity classes and mapping them to domain structs.

Frequently Asked Questions about swift-data

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

FAQPage Schema
How do I set up SwiftData persistence in a modular MVVM-C iOS app?

Set up SwiftData persistence by correctly configuring the ModelContainer and ModelContext for reliable local storage. This approach ensures data integrity and efficient app architecture within modular MVVM-C boundaries.

What is the best way to map SwiftData @Model entities to domain structs?

The best way to map @Model entities is to follow SwiftData best practices for data modeling, defining entity classes and mapping them directly to domain structs. This maintains clean data-only boundaries in your application.

How does SwiftData handle offline-first data synchronization and API integration?

SwiftData handles offline-first data synchronization using stale-while-revalidate reads and optimistic queued writes. These strategies manage API integration efficiently, ensuring data syncs reliably when network connectivity is restored.

Can I use SwiftData with SwiftUI while keeping data logic in separate boundaries?

Yes, you can use SwiftData with SwiftUI while maintaining Data-only boundaries. The Skill provides best practices for integrating persistence and state management cleanly within your SwiftUI views.

How do I execute schema migrations safely when using SwiftData?

Execute schema migrations safely by planning and executing schema management strategies provided by the Skill. This ensures data integrity is maintained across app updates without losing local data.