ios-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseiOS Development
iOS 开发
Start here. This skill coordinates the Apple skills collection — it tells you which skill to use and when, so you get opinionated guidance and full API references together.
从这里开始。本技能整合了Apple技能集合——它会告诉你何时使用何种技能,让你同时获得针对性指南和完整的API参考资料。
Operating Rules
操作规则
- SwiftUI and UIKit are both first-class — pick whichever fits the task. UIKit is a valid choice whenever it gives more control or flexibility; when bridging the two, watch state sync, lifecycle, and animation/environment boundaries.
- Do not enforce specific architectures (MVVM, VIPER, MV, TCA, etc.) — encourage separating business logic from views without mandating how
- Hold a high bar for UI craft: apps should feel current-generation — fluid, design-forward, alive. Sweat the tiny details. Custom components, novel interactions, and custom Metal shaders are all in-bounds when they serve the experience; system defaults are a floor, not a ceiling.
- Do not prescribe how that craft is delivered — no house style, no "Apple-approved" gatekeeping, no aesthetic checklists. Design direction is your own judgment call, made per app. The and
higskills document what the system provides; they are references, not style mandates. When the task is designing a screen or making it look good, there is no doc to route to — design from your own taste; grep references only when you need API mechanics or a factual minimum (e.g. hit-target sizes).ios-liquid-glass - Present performance optimizations as suggestions backed by reasoning, not blanket requirements
- When you need exact API details, grep the framework reference skills — they contain full Apple documentation
- SwiftUI和UIKit均为一等选择——选择最适合任务的即可。当UIKit能提供更多控制或灵活性时,它是合理的选择;在桥接两者时,需注意状态同步、生命周期以及动画/环境边界。
- 不要强制使用特定架构(MVVM、VIPER、MV、TCA等)——鼓励将业务逻辑与视图分离,但不规定具体实现方式
- 对UI工艺设定高标准:应用应具备当代质感——流畅、贴合设计、生动鲜活。注重微小细节。当自定义组件、新颖交互和自定义Metal着色器能提升用户体验时,均可使用;系统默认设置是基础,而非上限。
- 不规定工艺的实现方式——没有统一风格、没有“Apple认证”的门槛、没有审美清单。设计方向由你根据每个应用自行判断。和
hig技能记录了系统提供的内容;它们是参考资料,而非风格强制要求。当任务是设计屏幕或优化视觉效果时,无需跳转至其他文档——根据你的审美进行设计;仅当需要API机制或事实标准(如点击目标尺寸)时,再查阅参考资料。ios-liquid-glass - 将性能优化作为有依据的建议提出,而非一概而论的要求
- 当你需要准确的API细节时,查阅框架参考技能——它们包含完整的Apple文档
Task Workflows
任务工作流
Review existing code
审查现有代码
- Read the code and identify which topics apply
- Run the Correctness Checklist below — violations are bugs
- Use the Topic Router to load the relevant guide for each topic
- For API correctness, grep the matching framework reference skill
- 阅读代码并确定适用的主题
- 运行下方的正确性检查清单——违反规则即为漏洞
- 使用主题路由加载每个主题对应的相关指南
- 若需验证API正确性,查阅匹配的框架参考技能
Improve existing code
优化现有代码
- Run the correctness checklist first
- For performance issues: use
guide-swiftui-performance-audit - For navigation, state, or pattern questions: use
guide-swiftui-ui-patterns - For API details: grep the matching framework reference skill
- 先运行正确性检查清单
- 针对性能问题:使用
guide-swiftui-performance-audit - 针对导航、状态或模式问题:使用
guide-swiftui-ui-patterns - 若需API细节:查阅匹配的框架参考技能
Build a new feature
构建新功能
- Design data flow first — identify owned vs. injected state
- For UI patterns and app wiring: use
guide-swiftui-ui-patterns - For API details: grep the matching framework reference skill
- Structure views for optimal diffing — extract subviews early
- Run the correctness checklist before finishing
- 先设计数据流——区分自有状态与注入状态
- 针对UI模式和应用架构:使用
guide-swiftui-ui-patterns - 若需API细节:查阅匹配的框架参考技能
- 优化视图结构以实现最佳差异对比——尽早提取子视图
- 完成前运行正确性检查清单
Topic Router
主题路由
The Guide column has opinionated, short pattern guides. The API Reference column has full Apple documentation as grepable Markdown — use to find which framework has what.
apple-docs-index| Topic | Guide | API Reference |
|---|---|---|
| State management | | |
| View composition | — | |
| Performance | | — |
| Navigation | | |
| Sheets & modals | | |
| Lists & ForEach | | |
| ScrollView | | |
| Forms & input | — | |
| Charts | | |
| Animations | | |
| Layout | | |
| TabView | | |
| Liquid Glass | — | |
| Accessibility | | |
| macOS apps | | |
| Data persistence | | |
| Testing | | |
| Concurrency | | |
| In-app purchases | — | |
| Maps | — | |
| Health data | — | |
| Notifications | — | |
| App Intents / Siri | — | |
| Widgets | — | |
| App Store metadata | | — |
| Finding docs | | — |
指南列包含针对性的简短模式指南。API参考列包含可查阅的Markdown格式完整Apple文档——使用查找各框架的内容。
apple-docs-index| 主题 | 指南 | API参考 |
|---|---|---|
| 状态管理 | | |
| 视图组合 | — | |
| 性能优化 | | — |
| 导航 | | |
| 弹窗与模态框 | | |
| 列表与ForEach | | |
| 滚动视图 | | |
| 表单与输入 | — | |
| 图表 | | |
| 动画 | | |
| 布局 | | |
| 标签视图 | | |
| Liquid Glass | — | |
| 无障碍 | | |
| macOS应用 | | |
| 数据持久化 | | |
| 测试 | | |
| 并发 | | |
| 内购 | — | |
| 地图 | — | |
| 健康数据 | — | |
| 通知 | — | |
| App Intents / Siri | — | |
| 小组件 | — | |
| App Store元数据 | | — |
| 文档查找 | | — |
Correctness Checklist
正确性检查清单
These are hard rules — violations are always bugs:
- properties are
@Stateprivate - only where a child needs to mutate parent state
@Binding - Values passed in are never declared as — they silently ignore updates
@State - Use with
@Stateclasses — not@Observableor@StateObjectObservableObject - Use for injected observables that need bindings
@Bindable - uses stable identity — never
ForEachon dynamic content.indices - Each element produces a constant number of views
ForEach - always includes the
.animation(_:value:)parametervalue: - properties are
@FocusStateprivate - classes are
@Observable— Swift 6 strict concurrency requires it@MainActor - Property wrappers (,
@AppStorage,@SceneStorage) inside@Queryclasses are marked@Observable— they conflict with the macro and cause compiler errors@ObservationIgnored - No business logic in — use
body,.task, or methods.onChange - No unless truly unavoidable — fix with better composition
AnyView
这些是硬性规则——违反规则即为漏洞:
- 属性需为
@Stateprivate - 仅在子视图需要修改父视图状态时使用
@Binding - 传入的值绝不能声明为——否则会静默忽略更新
@State - 对类使用
@Observable——而非@State或@StateObjectObservableObject - 对需要绑定的注入可观察对象使用
@Bindable - 使用稳定标识——动态内容绝不能使用
ForEach.indices - 每个元素生成固定数量的视图
ForEach - 必须包含
.animation(_:value:)参数value: - 属性需为
@FocusStateprivate - 类需标记
@Observable——Swift 6严格并发要求此设置@MainActor - 类中的属性包装器(
@Observable、@AppStorage、@SceneStorage)需标记@Query——它们与宏冲突会导致编译错误@ObservationIgnored - 中不能包含业务逻辑——使用
body、.task或方法实现.onChange - 除非绝对必要,否则不要使用——通过更好的组合方式解决
AnyView
Related Skills
相关技能
System API reference:
- — Liquid Glass API reference
/ios-liquid-glass
Workflow guides:
- — Navigation, state, sheets, component patterns
/guide-swiftui-ui-patterns - — Implicit/explicit animation, transitions, keyframes
/guide-swiftui-animations - — Marks, axes, selection, styling, accessibility
/guide-swiftui-charts - — Diagnose and fix performance issues
/guide-swiftui-performance-audit - — Swift Testing patterns, async tests, common agent mistakes
/guide-swift-testing - — Concurrency patterns, actors, diagnostics, bug patterns
/guide-swift-concurrency - — SwiftData patterns, predicates, CloudKit constraints
/guide-swiftdata - — Build macOS apps with SwiftPM
/guide-macos-spm-packaging
Utilities:
- — Find the right Apple documentation
/apple-docs-index - — Simulator screenshots and device management
/simulator-utils - — App Store Optimization
/apple-aso
系统API参考:
- — Liquid Glass API参考
/ios-liquid-glass
工作流指南:
- — 导航、状态、弹窗、组件模式
/guide-swiftui-ui-patterns - — 隐式/显式动画、转场、关键帧
/guide-swiftui-animations - — 标记、坐标轴、选择、样式、无障碍
/guide-swiftui-charts - — 诊断并修复性能问题
/guide-swiftui-performance-audit - — Swift Testing模式、异步测试、常见Agent错误
/guide-swift-testing - — 并发模式、Actor、诊断、漏洞模式
/guide-swift-concurrency - — SwiftData模式、谓词、CloudKit约束
/guide-swiftdata - — 使用SwiftPM构建macOS应用
/guide-macos-spm-packaging
实用工具:
- — 查找合适的Apple文档
/apple-docs-index - — 模拟器截图与设备管理
/simulator-utils - — App Store优化
/apple-aso