快速模式
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 数据
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# 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 -->
章节与文件索引
按说明文件中的顺序排列。
关键原则
性能
App Store 提交清单
文件/命令 -> @Published · @State · LazyVStack · LazyHStack · VStack · @MainActor · equatable() · @StateObject
内容校验值 -> 2b228a820709
当前原文的自动摘译,尚未人工审校。
关键原则
视图是愚蠢的:它们呈现状态和转发操作 - 没有业务逻辑 ViewModels 自己的状态:
@Published属性,@State仅适用于本地 UI 服务是无状态的:网络调用、数据库操作、分析 协调器处理导航:从视图中删除导航使它们可重用性能
对于大型列表,使用
LazyVStack/LazyHStack,而不是VStack使用@MainActor显式标记视图 在复杂视图上使用equatable()以防止不必要的重新渲染 对于本地,首选@State,对于拥有的,@StateObject,对于传入的@ObservedObjectApp Store 提交清单
[]没有硬编码的API密钥[]TestFlight beta测试与真实用户[]隐私清单更新[]所有所需尺寸的屏幕截图[]应用商店描述和关键字准备就绪