快速模式

数据 社区

技能解读

当前原文的自动摘译,尚未人工审校。

关键原则

视图是愚蠢的:它们呈现状态和转发操作 - 没有业务逻辑 ViewModels 自己的状态:@Published 属性,@State 仅适用于本地 UI 服务是无状态的:网络调用、数据库操作、分析 协调器处理导航:从视图中删除导航使它们可重用

性能

对于大型列表,使用 LazyVStack/LazyHStack,而不是 VStack 使用 @MainActor 显式标记视图 在复杂视图上使用 equatable() 以防止不必要的重新渲染 对于本地,首选 @State,对于拥有的,@StateObject,对于传入的@ObservedObject

App Store 提交清单

[]没有硬编码的API密钥[]TestFlight beta测试与真实用户[]隐私清单更新[]所有所需尺寸的屏幕截图[]应用商店描述和关键字准备就绪

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
数据
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# iOS Swift Patterns

Production-grade iOS development with Swift, SwiftUI, and UIKit.

## Architecture

### MVVM + Coordinator Pattern
```
View (SwiftUI/UIViewController)
  ↕ binds to
ViewModel (ObservableObject)
  ↕ calls
Service Layer (Networking, DB)
  ↕
Core Data / API
```

### Key Principles
- **Views are dumb**: They render state and forward actions — no business logic
- **ViewModels own state**: `@Published` properties, `@State` only for local UI
- **Services are stateless**: Network calls, DB operations, analytics
- **Coordinators handle navigation**: Removing navigation from views makes them reusable

## SwiftUI Best Practices

### Performance
- Use `LazyVStack`/`LazyHStack` for large lists, not `VStack`
- Mark views with `@MainActor` explicitly
- Use `equatable()` on complex views to prevent unnecessary re-renders
- Prefer `@State` for local, `@StateObject` for owned, `@ObservedObject` for passed-in

### State Management
```swift
// Good: Clear separation
@MainActor
class UserViewModel: ObservableObject {
    @Published var users: [User] = []
    @Published var isLoading = false

    func loadUsers() async {
        isLoading = true
        users = await userService.fetchUsers()
        isLoading = false
    }
}
```

## App Store Submission Checklist
- [ ] No Hardcoded API keys
- [ ] TestFlight beta tested with real users
- [ ] Privacy manifest updated
- [ ] Screenshots for all required sizes
- [ ] App Store description and keywords ready
- [ ] Subscription/IAP products configured

---
> Source: [cosmicstack-labs/mercury-agent-skills](https://github.com/cosmicstack-labs/mercury-agent-skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。