ios-swift-patterns
- Repo stars 0
- Author repo 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.
- Fluxly category
- Data
- Author-declared agents
- No explicit declaration found; this is not inferred or tested compatibility
- Static check
- 88 / 100 · heuristic scan, not runtime safety proof
- Author / version / license
- @tomevault-io · no license declared
- Fluxly token estimate
- Lean
- Fluxly setup estimate
- Plug-and-play
- External API key
- No requirement detected
- Detected OS requirements
- Unspecified
- Runtime requirements
- Unspecified
- Detected file/system behavior
-
- Read-only
- Detected network behavior
- Local-only
- Install commands
- None (reference only)
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
The current SKILL.md does not define a fixed output example. Architecture
MVVM + Coordinator Pattern
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
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
# 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 --> Author text anchors workflow facts; Fluxly only indexes current sections, terms, files, and commands.
sections -> Architecture → MVVM + Coordinator Pattern → Key Principles → SwiftUI Best Practices → Performance → State Management
terms -> Views are dumb · ViewModels own state · Services are stateless · Coordinators handle navigation
files/cmd -> @Published · @State · LazyVStack · LazyHStack · VStack · @MainActor · equatable() · @StateObject
body sha256 -> 2b228a820709
Decide Fit First
Design Intent
How To Use It
Boundaries And Review