swiftui-patterns
SwiftUI 架构模式、使用 @Observable 的状态管理、视图组合、导航、性能优化以及现代 iOS/macOS UI 最佳实践。在构建或审查 SwiftUI 视图、@Observable 状态、导航或渲染性能时使用。
机器翻译查看英文原文
SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices. Use when building or reviewing SwiftUI views, @Observable state, navigation, or render performance.
适用对象:移动应用开发。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- SwiftUI Patterns
- When to Activate
- State Management
- Property Wrapper Selection
- @Observable ViewModel
- View Consuming the ViewModel
- Environment Injection
- View Composition
Modern SwiftUI patterns for building declarative, performant user interfaces on Apple platforms. Covers the Observation framework, view composition, type-safe navigation, and performance optimization. Building SwiftUI views and managing state (@State, @Observable, @Binding) Designing navigation flows with NavigationStack Structuring view models and data flow Optimizing rendering performance for lists and complex layouts Working with environment values and dependency injection in SwiftUI Choose the simplest wrapper that fits: | Wrapper | Use Case | |---------|----------| | @State | View-local value types (toggles, form fields, sheet presentation) | | @Binding | Two-way reference to parent's @State | | @Observable class + @State | Owned model with multiple properties | | @Observable class (no wrapper) | Read-only reference passed from parent | | @Bindable | Two-way binding to an @Observable property | | @Environment | Shared dependencies injected via .environment() | Use @Observable (not ObservableObject) — it tracks property-level changes so SwiftUI only re-renders views that read the changed property: Replace @EnvironmentObject with @Environment: Break views into small, focused str
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- affaan-m/ECC
- 源文件
- pi/core/skills/swiftui-patterns/SKILL.md
- 固定版本
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:affaan-m/ECC · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T15:01:43.290Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。