swiftdata-expert

Guide SwiftData model definition, persistence, and concurrency for iOS and macOS.

1|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/adamayoung/popcorn --skill swiftdata-expert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftdata-expert
Source: https://github.com/adamayoung/popcorn/tree/main/.claude/skills/swiftdata-expert
Command: npx skills add https://github.com/adamayoung/popcorn --skill swiftdata-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill resolves complex challenges in SwiftData implementation, including concurrency management, CloudKit synchronization, and schema migration, ensuring robust and performant data persistence.

Core Features & Use Cases

  • Architecture Guidance: Provides authoritative patterns for ModelContainer, ModelContext, and @ModelActor usage.
  • Migration Planning: Offers step-by-step strategies for VersionedSchema and SchemaMigrationPlan to prevent data loss.
  • Use Case: Use this Skill when you need to safely refactor a local-only cache store into a CloudKit-synced user data model without breaking existing production data.

Quick Start

Use the swiftdata-expert skill to review my current model definitions and suggest the necessary migration plan for adding a new property to my CloudKit-synced entity.

Frequently Asked Questions about swiftdata-expert

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

FAQPage Schema
How do I implement SwiftData concurrency patterns in iOS?

Implement SwiftData concurrency using the @ModelActor macro to safely manage ModelContext access across isolated execution domains. This pattern ensures strict Swift 6 concurrency compliance while maintaining efficient data persistence.

What is the best way to migrate a SwiftData schema without losing data?

Migrate SwiftData schemas safely by defining a VersionedSchema and creating a SchemaMigrationPlan. This approach provides step-by-step strategies to transition between models and prevents data loss during production updates.

Can I use SwiftData with CloudKit synchronization?

Yes, SwiftData supports CloudKit synchronization to sync user data across devices. You can safely refactor a local-only cache store into a CloudKit-synced data model without breaking existing production data.

Do I need Swift 6 strict concurrency for SwiftData ModelContainer operations?

Yes, adhering to strict Swift 6 concurrency rules is required for safe ModelContainer and ModelContext operations. This ensures data races are prevented and efficient data management strategies are maintained.

How do I add a new property to a CloudKit-synced SwiftData entity?

Review your model definitions and generate a SchemaMigrationPlan to add the new property. This ensures the CloudKit-synced entity updates correctly across versions without corrupting existing data.