ios-dev

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

iOS 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
    hig
    and
    ios-liquid-glass
    skills 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).
  • 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
    ios-liquid-glass
    技能记录了系统提供的内容;它们是参考资料,而非风格强制要求。当任务是设计屏幕或优化视觉效果时,无需跳转至其他文档——根据你的审美进行设计;仅当需要API机制或事实标准(如点击目标尺寸)时,再查阅参考资料。
  • 将性能优化作为有依据的建议提出,而非一概而论的要求
  • 当你需要准确的API细节时,查阅框架参考技能——它们包含完整的Apple文档

Task Workflows

任务工作流

Review existing code

审查现有代码

  1. Read the code and identify which topics apply
  2. Run the Correctness Checklist below — violations are bugs
  3. Use the Topic Router to load the relevant guide for each topic
  4. For API correctness, grep the matching framework reference skill
  1. 阅读代码并确定适用的主题
  2. 运行下方的正确性检查清单——违反规则即为漏洞
  3. 使用主题路由加载每个主题对应的相关指南
  4. 若需验证API正确性,查阅匹配的框架参考技能

Improve existing code

优化现有代码

  1. Run the correctness checklist first
  2. For performance issues: use
    guide-swiftui-performance-audit
  3. For navigation, state, or pattern questions: use
    guide-swiftui-ui-patterns
  4. For API details: grep the matching framework reference skill
  1. 先运行正确性检查清单
  2. 针对性能问题:使用
    guide-swiftui-performance-audit
  3. 针对导航、状态或模式问题:使用
    guide-swiftui-ui-patterns
  4. 若需API细节:查阅匹配的框架参考技能

Build a new feature

构建新功能

  1. Design data flow first — identify owned vs. injected state
  2. For UI patterns and app wiring: use
    guide-swiftui-ui-patterns
  3. For API details: grep the matching framework reference skill
  4. Structure views for optimal diffing — extract subviews early
  5. Run the correctness checklist before finishing
  1. 先设计数据流——区分自有状态与注入状态
  2. 针对UI模式和应用架构:使用
    guide-swiftui-ui-patterns
  3. 若需API细节:查阅匹配的框架参考技能
  4. 优化视图结构以实现最佳差异对比——尽早提取子视图
  5. 完成前运行正确性检查清单

Topic Router

主题路由

The Guide column has opinionated, short pattern guides. The API Reference column has full Apple documentation as grepable Markdown — use
apple-docs-index
to find which framework has what.
TopicGuideAPI Reference
State management
guide-swiftui-ui-patterns
swiftui
(state.md, binding.md, observation.md, environment.md)
View composition
swiftui
(view-protocol.md)
Performance
guide-swiftui-performance-audit
Navigation
guide-swiftui-ui-patterns
swiftui
(navigationstack.md, navigationsplitview.md, navigationlink.md)
Sheets & modals
guide-swiftui-ui-patterns
swiftui
(sheet.md, inspector.md, alert.md, confirmationdialog.md)
Lists & ForEach
guide-swiftui-ui-patterns
swiftui
(list.md)
ScrollView
guide-swiftui-ui-patterns
swiftui
(scrollview.md)
Forms & input
swiftui
(form.md, textfield.md, picker.md, toggle.md, slider.md)
Charts
guide-swiftui-charts
swiftui
(chart.md, charts-overview.md)
Animations
guide-swiftui-animations
swiftui
(swiftui-overview.md)
Layout
guide-swiftui-ui-patterns
swiftui
(geometryreader.md, grid.md, hstack.md, vstack.md, zstack.md, spacer.md)
TabView
guide-swiftui-ui-patterns
swiftui
(tabview.md)
Liquid Glass
ios-liquid-glass
Accessibility
guide-swiftui-ui-patterns
hig
(a11y/ergonomic facts)
macOS apps
guide-macos-spm-packaging
swiftui
,
uikit
Data persistence
guide-swiftdata
swiftdata
Testing
guide-swift-testing
swift-testing
,
xcuitest
Concurrency
guide-swift-concurrency
swift-concurrency
In-app purchases
storekit
Maps
mapkit
Health data
healthkit
Notifications
usernotifications
App Intents / Siri
appintents
Widgets
widgetkit
App Store metadata
apple-aso
Finding docs
apple-docs-index
指南列包含针对性的简短模式指南。API参考列包含可查阅的Markdown格式完整Apple文档——使用
apple-docs-index
查找各框架的内容。
主题指南API参考
状态管理
guide-swiftui-ui-patterns
swiftui
(state.md, binding.md, observation.md, environment.md)
视图组合
swiftui
(view-protocol.md)
性能优化
guide-swiftui-performance-audit
导航
guide-swiftui-ui-patterns
swiftui
(navigationstack.md, navigationsplitview.md, navigationlink.md)
弹窗与模态框
guide-swiftui-ui-patterns
swiftui
(sheet.md, inspector.md, alert.md, confirmationdialog.md)
列表与ForEach
guide-swiftui-ui-patterns
swiftui
(list.md)
滚动视图
guide-swiftui-ui-patterns
swiftui
(scrollview.md)
表单与输入
swiftui
(form.md, textfield.md, picker.md, toggle.md, slider.md)
图表
guide-swiftui-charts
swiftui
(chart.md, charts-overview.md)
动画
guide-swiftui-animations
swiftui
(swiftui-overview.md)
布局
guide-swiftui-ui-patterns
swiftui
(geometryreader.md, grid.md, hstack.md, vstack.md, zstack.md, spacer.md)
标签视图
guide-swiftui-ui-patterns
swiftui
(tabview.md)
Liquid Glass
ios-liquid-glass
无障碍
guide-swiftui-ui-patterns
hig
(a11y/ergonomic facts)
macOS应用
guide-macos-spm-packaging
swiftui
,
uikit
数据持久化
guide-swiftdata
swiftdata
测试
guide-swift-testing
swift-testing
,
xcuitest
并发
guide-swift-concurrency
swift-concurrency
内购
storekit
地图
mapkit
健康数据
healthkit
通知
usernotifications
App Intents / Siri
appintents
小组件
widgetkit
App Store元数据
apple-aso
文档查找
apple-docs-index

Correctness Checklist

正确性检查清单

These are hard rules — violations are always bugs:
  • @State
    properties are
    private
  • @Binding
    only where a child needs to mutate parent state
  • Values passed in are never declared as
    @State
    — they silently ignore updates
  • Use
    @State
    with
    @Observable
    classes — not
    @StateObject
    or
    ObservableObject
  • Use
    @Bindable
    for injected observables that need bindings
  • ForEach
    uses stable identity — never
    .indices
    on dynamic content
  • Each
    ForEach
    element produces a constant number of views
  • .animation(_:value:)
    always includes the
    value:
    parameter
  • @FocusState
    properties are
    private
  • @Observable
    classes are
    @MainActor
    — Swift 6 strict concurrency requires it
  • Property wrappers (
    @AppStorage
    ,
    @SceneStorage
    ,
    @Query
    ) inside
    @Observable
    classes are marked
    @ObservationIgnored
    — they conflict with the macro and cause compiler errors
  • No business logic in
    body
    — use
    .task
    ,
    .onChange
    , or methods
  • No
    AnyView
    unless truly unavoidable — fix with better composition
这些是硬性规则——违反规则即为漏洞:
  • @State
    属性需为
    private
  • 仅在子视图需要修改父视图状态时使用
    @Binding
  • 传入的值绝不能声明为
    @State
    ——否则会静默忽略更新
  • @Observable
    类使用
    @State
    ——而非
    @StateObject
    ObservableObject
  • 对需要绑定的注入可观察对象使用
    @Bindable
  • ForEach
    使用稳定标识——动态内容绝不能使用
    .indices
  • 每个
    ForEach
    元素生成固定数量的视图
  • .animation(_:value:)
    必须包含
    value:
    参数
  • @FocusState
    属性需为
    private
  • @Observable
    类需标记
    @MainActor
    ——Swift 6严格并发要求此设置
  • @Observable
    类中的属性包装器(
    @AppStorage
    @SceneStorage
    @Query
    )需标记
    @ObservationIgnored
    ——它们与宏冲突会导致编译错误
  • body
    中不能包含业务逻辑——使用
    .task
    .onChange
    或方法实现
  • 除非绝对必要,否则不要使用
    AnyView
    ——通过更好的组合方式解决

Related Skills

相关技能

System API reference:
  • /ios-liquid-glass
    — Liquid Glass API reference
Workflow guides:
  • /guide-swiftui-ui-patterns
    — Navigation, state, sheets, component patterns
  • /guide-swiftui-animations
    — Implicit/explicit animation, transitions, keyframes
  • /guide-swiftui-charts
    — Marks, axes, selection, styling, accessibility
  • /guide-swiftui-performance-audit
    — Diagnose and fix performance issues
  • /guide-swift-testing
    — Swift Testing patterns, async tests, common agent mistakes
  • /guide-swift-concurrency
    — Concurrency patterns, actors, diagnostics, bug patterns
  • /guide-swiftdata
    — SwiftData patterns, predicates, CloudKit constraints
  • /guide-macos-spm-packaging
    — Build macOS apps with SwiftPM
Utilities:
  • /apple-docs-index
    — Find the right Apple documentation
  • /simulator-utils
    — Simulator screenshots and device management
  • /apple-aso
    — App Store Optimization
系统API参考:
  • /ios-liquid-glass
    — Liquid Glass API参考
工作流指南:
  • /guide-swiftui-ui-patterns
    — 导航、状态、弹窗、组件模式
  • /guide-swiftui-animations
    — 隐式/显式动画、转场、关键帧
  • /guide-swiftui-charts
    — 标记、坐标轴、选择、样式、无障碍
  • /guide-swiftui-performance-audit
    — 诊断并修复性能问题
  • /guide-swift-testing
    — Swift Testing模式、异步测试、常见Agent错误
  • /guide-swift-concurrency
    — 并发模式、Actor、诊断、漏洞模式
  • /guide-swiftdata
    — SwiftData模式、谓词、CloudKit约束
  • /guide-macos-spm-packaging
    — 使用SwiftPM构建macOS应用
实用工具:
  • /apple-docs-index
    — 查找合适的Apple文档
  • /simulator-utils
    — 模拟器截图与设备管理
  • /apple-aso
    — App Store优化