swiftdata-coredata-persistence

swiftdata-coredata-persistence is a skill for Claude Code, Codex from dagba/ios-mcp. It costs 38 tokens per session (2,818 once invoked), scanned A, original, MIT.

A guide to storing app data on Apple devices with SwiftData or Core Data, Apple’s built-in systems for saving structured information between launches.

In plain words
What is it for?
Use it to choose between SwiftData and Core Data, design data models, plan updates that change those models, fix migration errors, and improve fetch performance.
Why use it?
It helps avoid choosing the wrong storage system, breaking existing data during app updates, or making database reads unnecessarily slow.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to choose between SwiftData and Core Data, design data models, plan updates that change those models, fix migration errors, and improve fetch performance.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dagba/ios-mcp/swiftdata-coredata-persistence
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dagba/ios-mcp --skill swiftdata-coredata-persistence
Clone the repo
git clone --depth 1 https://github.com/dagba/ios-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swiftdata-coredata-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/dagba/ios-mcp/swiftdata-coredata-persistence.svg)](https://agentmods.dev/skills/dagba/ios-mcp/swiftdata-coredata-persistence)
Your own site
<a href="https://agentmods.dev/skills/dagba/ios-mcp/swiftdata-coredata-persistence"><img src="https://agentmods.dev/badge/skills/dagba/ios-mcp/swiftdata-coredata-persistence.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,818 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.02818
Opus 5 $0.00019 $0.01409
Sonnet 5 $0.00008 $0.00564
Haiku 4.5 $0.00004 $0.00282

Measured 8d ago against content hash 6bd7c3b01b0e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

swiftdata-coredata-persistence scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

let items = try context.fetch(FetchDescriptor<OldSchema.Product>())
skills/swiftdata-coredata-persistence/SKILL.md · 370 lines

How it starts

The opening of the file, as written. The whole thing — 370 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SwiftData & CoreData Persistence

Overview

SwiftData and CoreData are NOT interchangeable. Each has specific strengths, migration traps, and performance patterns. Wrong framework choice or migration strategy causes production crashes.

Core principle: Choose framework based on app constraints, version models from day one, never store BLOBs in the database.

Framework Selection

digraph framework_choice {
    "New iOS app?" [shape=diamond];
    "iOS 17+ only?" [shape=diamond];
    "Simple data model?" [shape=diamond];
    "iCloud sync?" [shape=diamond];
    "Existing CoreData?" [shape=diamond];
    "Use SwiftData" [shape=box, style=filled, fillcolor=lightgreen];
    "Use CoreData" [shape=box, style=filled, fillcolor=lightblue];
    "Stay with CoreData" [shape=box, style=filled, fillcolor=lightblue];

    "New iOS app?" -> "iOS 17+ only?" [label="yes"];
    "New iOS app?" -> "Existing CoreData?" [label="no"];
    "Existing CoreData?" -> "Stay with CoreData" [label="yes"];
    "Existing CoreData?" -> "iOS 17+ only?" [label="no"];
    "iOS 17+ only?" -> "Simple data model?" [label="yes"];
    "iOS 17+ only?" -> "Use CoreData" [label="no"];
    "Simple data model?" -> "iCloud sync?" [label="yes"];
    "Simple data model?" -> "Use CoreData" [label="no"];
    "iCloud sync?" -> "Use SwiftData" [label="yes"];
    "iCloud sync?" -> "Use SwiftData" [label="no"];
}

Choose SwiftData When

  • New app, iOS 17+ deployment target
  • Simple relationships (mostly 1:1 or 1:N, few complex queries)
  • SwiftUI-first architecture
  • iCloud sync needed with minimal configuration

Choose CoreData When

  • iOS 16 or earlier support required
  • Complex queries with NSCompoundPredicate, subqueries
  • UIKit-heavy app with NSFetchedResultsController
  • Existing CoreData codebase (migration complex, stay with CoreData)
  • Performance critical (as of 2025, CoreData still faster)
  • Abstract entities or inheritance hierarchies

Migration Death Traps

Read the full file on GitHub · 370 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 370 lines · 38 tokens per session scan A 6bd7c3b01b0e

Subscribe to this mod's changes

swiftdata-coredata-persistence is a skill published in the GitHub repository dagba/ios-mcp (3 stars, last pushed 7mo ago), licensed MIT. It adds 38 tokens to every session and 2,818 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.