ios 代码同步
- 作者仓库星标 0
- 作者仓库 skills-registry
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:
@Publishedproperties,@Stateonly 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/LazyHStackfor large lists, notVStack - Mark views with
@MainActorexplicitly - Use
equatable()on complex views to prevent unnecessary re-renders - Prefer
@Statefor local,@StateObjectfor owned,@ObservedObjectfor passed-in
State Management
// 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
<!-- tomevault:4.0:skill_md:2026-05-23 -->Source: cosmicstack-labs/mercury-agent-skills — distributed by TomeVault.
- 流狐分类
- 数据
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @tomevault-io · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Architecture
Architecture
MVVM + Coordinator Pattern
MVVM + Coordinator Pattern
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
SwiftUI Best Practices
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
State Management
State Management
# 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 --> 证据边界与执行链路
作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Architecture → MVVM + Coordinator Pattern → Key Principles → SwiftUI Best Practices → Performance → State Management
要点 -> Views are dumb · ViewModels own state · Services are stateless · Coordinators handle navigation
文件/命令 -> @Published · @State · LazyVStack · LazyHStack · VStack · @MainActor · equatable() · @StateObject
内容 SHA-256 -> 2b228a820709
原文结构
适用与边界
原文中的明确线索
@Published、@State、LazyVStack、LazyHStack、VStack、@MainActor、equatable()、@StateObject