guide-swiftdata
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGuide Skill — This is an expert workflow/pattern guide, not API reference documentation. Originally from twostraws/SwiftData-Agent-Skill by Paul Hudson. MIT License.
Guide Skill — 这是一份专业的工作流/模式指南,而非API参考文档。 原文来自 Paul Hudson 的 twostraws/SwiftData-Agent-Skill。采用 MIT 许可证。
SwiftData Patterns
SwiftData Patterns
Write and review SwiftData code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems — do not nitpick or invent issues.
编写和评审SwiftData代码,确保正确性、现代API使用以及符合项目规范。仅报告真实存在的问题——不要吹毛求疵或捏造问题。
Core Instructions
核心说明
- Target Swift 6.2 or later, using modern Swift concurrency.
- Prefer SwiftData across the board. Do not suggest Core Data unless the feature cannot be solved with SwiftData.
- Do not introduce third-party frameworks without asking first.
- 目标为Swift 6.2或更高版本,使用现代Swift并发机制。
- 全面优先使用SwiftData。除非功能无法通过SwiftData实现,否则不要建议使用Core Data。
- 未经询问不要引入第三方框架。
Review Process
评审流程
- Check for core SwiftData issues using .
references/core-rules.md - Check that predicates are safe and supported using .
references/predicates.md - If the project uses CloudKit, check for CloudKit-specific constraints using .
references/cloudkit.md - If the project targets iOS 18+, check for indexing opportunities using .
references/indexing.md - If the project targets iOS 26+, check for class inheritance patterns using .
references/class-inheritance.md
If doing partial work, load only the relevant reference files.
- 使用检查核心SwiftData问题。
references/core-rules.md - 使用检查谓词是否安全且受支持。
references/predicates.md - 如果项目使用CloudKit,使用检查CloudKit特定约束。
references/cloudkit.md - 如果项目针对iOS 18+,使用检查索引优化机会。
references/indexing.md - 如果项目针对iOS 26+,使用检查类继承模式。
references/class-inheritance.md
如果仅处理部分工作,仅加载相关的参考文件。
References
参考资料
| Topic | Reference |
|---|---|
Autosave, relationships, delete rules, | |
| Supported predicates, dangerous patterns that crash at runtime, unsupported methods | |
CloudKit constraints: no | |
| Database indexing (iOS 18+), single and compound property indexes | |
Model subclassing (iOS 26+), | |
| 主题 | 参考文件 |
|---|---|
自动保存、关联关系、删除规则、 | |
| 受支持的谓词、运行时会崩溃的危险模式、不受支持的方法 | |
CloudKit约束:不支持 | |
| 数据库索引(iOS 18+)、单属性与复合属性索引 | |
模型子类化(iOS 26+)、 | |