AgentSkillsCN

swiftui-best-practices

SwiftUI 在行为、结构与性能方面的最佳实践。当设计或评审 SwiftUI 视图、管理状态、制定布局决策、实现动画效果,或进行性能调优时,可选用此技能;当你不确定如何建模状态与依赖关系时,当你希望避免条件视图带来的陷阱时,或者当你需要优化 diffing、ForEach 的身份标识,以及渲染成本时,也可选用此技能。

SKILL.md
--- frontmatter
name: swiftui-best-practices
description: SwiftUI best practices for behavior, structure, and performance. Use when designing or reviewing SwiftUI views, state management, layout decisions, animations, or performance tuning; when unsure how to model state vs dependencies; when avoiding conditional view pitfalls; or when optimizing diffing, ForEach identity, and rendering costs.

SwiftUI Best Practices

Overview

Concise guardrails and checklists for writing correct, maintainable, and performant SwiftUI. Use the cheatsheets below, and open per-theme references for detail: references/behavior.md, references/structure.md, references/performance.md.

Reference

  • Behavior: references/behavior.md
  • Structure: references/structure.md
  • Performance: references/performance.md