swiftdata

Model, persist, and query Swift app data with SwiftData.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/femitz/flyby --skill swiftdata-femitz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftdata
Source: https://github.com/femitz/flyby/tree/main/.agents/skills/swiftdata
Command: npx skills add https://github.com/femitz/flyby --skill swiftdata-femitz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

SwiftData provides a modern, type-safe approach to modeling, persisting, and querying app data in Swift.

Core Features & Use Cases

  • Define models with @Model, @Attribute, and @Relationship to express domain data.
  • Query data using @Query, #Predicate, FetchDescriptor, and SortDescriptor across SwiftUI and background contexts.
  • Manage migrations with VersionedSchema, SchemaMigrationPlan, and cross-store coexistence with Core Data.

Quick Start

Define your @Model classes, configure a ModelContainer, and perform reads and writes with ModelContext.

Frequently Asked Questions about swiftdata

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

FAQPage Schema
How do I migrate Core Data data to SwiftData?

Manage SwiftData migrations using VersionedSchema and SchemaMigrationPlan to handle incremental schema changes. This enables controlled data evolution across app versions while maintaining backward compatibility with existing persistent stores.

How do I query persistent data in SwiftUI using SwiftData?

Query persistent data in SwiftUI using @Query with #Predicate, FetchDescriptor, and SortDescriptor. This combination provides type-safe filtering and sorting capabilities directly within your SwiftUI views and background ModelContext operations.

Does SwiftData work with CloudKit for data synchronization?

Yes, SwiftData integrates with CloudKit for data synchronization. Configure your ModelContainer with appropriate ModelConfiguration settings to enable automatic syncing across user devices while maintaining local persistence.

How do I define data models in SwiftData?

Define SwiftData models using the @Model macro alongside @Attribute and @Relationship annotations. This modern approach expresses domain data through type-safe Swift classes while ModelContainer and ModelContext manage the lifecycle.

Can I use SwiftData for background data processing?

Yes, SwiftData handles background data processing through @ModelActor and background ModelContext operations. This enables safe concurrent access to persistent stores while maintaining type-safe querying with FetchDescriptor and #Predicate.

What's the difference between SwiftData and Core Data for Swift persistence?

SwiftData provides a modern type-safe Swift-native persistence layer using @Model, while Core Data offers mature ObjC-based frameworks. SwiftData supports CloudKit sync and Core Data coexistence, allowing gradual migration using VersionedSchema and SchemaMigrationPlan.