Ios persistence

From HoangNguyen0403/agent-skills-standard · View interactive version

Ios persistence is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Implement local persistence with SwiftData, Core Data, and secure storage. Use when setting up SwiftData models, Core Data stacks, or local persistence in iOS.

How to use this skill

Skill file

iOS Persistence

**Priority: P0 (CRITICAL)**

Implementation Workflow

  1. Choose storage tier — SwiftData for iOS 17+, Core Data for legacy, Apple secure credential storage for secrets, UserDefaults for flags only.
  2. Define models — Use @Model macro (SwiftData) or .xcdatamodeld (Core Data).
  3. Configure container — Use @MainActor for ModelContainer (SwiftData) or NSPersistentContainer (Core Data).
  4. Perform background writes — Use newBackgroundContext() (Core Data) to avoid UI lag; never heavy I/O on viewContext.
  5. Secure sensitive data — Use secure storage for tokens and PII; never store in UserDefaults.

See SwiftData and Core Data implementation examples

Anti-Patterns

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.