ios-xcode
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseiOS Xcode & Tooling Best Practices
iOS Xcode与工具使用最佳实践
Comprehensive guide for Xcode project configuration, SwiftData persistence, testing, debugging, profiling, and app distribution. Contains 19 rules across 6 categories.
本指南全面介绍Xcode项目配置、SwiftData持久化、测试、调试、性能分析及应用分发的相关内容,涵盖6大类别共19条规则。
When to Apply
适用场景
Reference these guidelines when:
- Setting up Xcode projects with AppStorage, ScenePhase, or widgets
- Implementing SwiftData models, queries, and CRUD operations
- Writing tests with Swift Testing framework
- Debugging with breakpoints and console output
- Profiling performance with Instruments
- Distributing apps via TestFlight
- Building for visionOS or integrating ML features
在以下场景中可参考本指南:
- 配置包含AppStorage、ScenePhase或小组件的Xcode项目
- 实现SwiftData模型、查询及CRUD操作
- 使用Swift Testing框架编写测试用例
- 借助断点与控制台输出进行调试
- 使用Instruments进行性能分析
- 通过TestFlight分发应用
- 开发visionOS应用或集成ML功能
Rule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | SwiftData & Persistence | CRITICAL | |
| 2 | Project & Platform | HIGH | |
| 3 | Testing | HIGH | |
| 4 | Debugging & Profiling | MEDIUM-HIGH | |
| 5 | Distribution | MEDIUM | |
| 6 | Specialty Platforms | MEDIUM | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | SwiftData与持久化 | 关键 | |
| 2 | 项目与平台 | 高 | |
| 3 | 测试 | 高 | |
| 4 | 调试与性能分析 | 中高 | |
| 5 | 应用分发 | 中 | |
| 6 | 特色平台 | 中 | |
Quick Reference
快速参考
1. Project & Platform (HIGH)
1. 项目与平台(高优先级)
- - Use AppStorage for user preferences
platform-app-storage - - Respond to app lifecycle with ScenePhase
platform-scene-phase - - Design for widget and Live Activity integration
platform-widget-integration - - Integrate system features natively
platform-system-features
- - 使用AppStorage存储用户偏好设置
platform-app-storage - - 通过ScenePhase响应应用生命周期
platform-scene-phase - - 适配小组件与Live Activity集成设计
platform-widget-integration - - 原生集成系统功能
platform-system-features
2. SwiftData & Persistence (CRITICAL)
2. SwiftData与持久化(关键优先级)
- - Define models with @Model macro
data-model-macro - - Use @Query for fetching data
data-query-for-fetching - - Configure model containers
data-model-container - - Define model relationships
data-relationships - - Implement CRUD operations
data-crud-operations
- - 使用@Model宏定义模型
data-model-macro - - 使用@Query获取数据
data-query-for-fetching - - 配置模型容器
data-model-container - - 定义模型关联关系
data-relationships - - 实现CRUD操作
data-crud-operations
3. Testing (HIGH)
3. 测试(高优先级)
- - Use Swift Testing framework
test-swift-testing - - Create preview sample data
test-preview-sample-data - - Use #Preview macro for rapid iteration
test-preview-macro
- - 使用Swift Testing框架
test-swift-testing - - 创建预览示例数据
test-preview-sample-data - - 使用#Preview宏实现快速迭代
test-preview-macro
4. Debugging & Profiling (MEDIUM-HIGH)
4. 调试与性能分析(中高优先级)
- - Use breakpoints for debugging
debug-breakpoints - - Use console output for debugging
debug-console-output - - Profile SwiftUI with Instruments
perf-instruments-profiling
- - 使用断点进行调试
debug-breakpoints - - 使用控制台输出进行调试
debug-console-output - - 使用Instruments分析SwiftUI性能
perf-instruments-profiling
5. Distribution (MEDIUM)
5. 应用分发(中优先级)
- - Distribute via TestFlight
dist-testflight - - Design app icons for distribution
dist-app-icons
- - 通过TestFlight分发应用
dist-testflight - - 设计用于分发的应用图标
dist-app-icons
6. Specialty Platforms (MEDIUM)
6. 特色平台(中优先级)
- - Integrate Natural Language ML
ml-natural-language - - Build for visionOS spatial computing
spatial-visionos-windows
- - 集成自然语言ML功能
ml-natural-language - - 开发visionOS空间计算应用
spatial-visionos-windows
How to Use
使用方法
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
阅读各参考文件获取详细说明及代码示例:
- 章节定义 - 类别结构与影响级别说明
- 规则模板 - 添加新规则的模板
Reference Files
参考文件
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| 文件 | 描述 |
|---|---|
| references/_sections.md | 类别定义与排序说明 |
| assets/templates/_template.md | 新规则模板 |