ios
Use this skill when working on iOS client (大前端 / 移动端) codebases.
Defaults (unless repo dictates otherwise)
- •Language: Swift
- •UI: SwiftUI (if UIKit exists, follow existing architecture and integrate incrementally)
- •Architecture: MVVM + unidirectional state where appropriate
- •Concurrency: async/await,
Task,Actoras needed - •Modularization: Swift Package Manager (SPM) if present
Project structure (recommended)
- •
App/: application entry, app lifecycle, root navigation - •
Features/<Name>/: feature modules (UI + ViewModel + domain models) - •
Core/: shared utilities, design system, logging, networking primitives - •
Data/: API clients, persistence implementations - •
Resources/: assets, localization
Workflow
- •Establish constraints
- •iOS deployment target, supported devices, required permissions.
- •SwiftUI vs UIKit and existing patterns (coordinator, reducers, etc.).
- •Define app flows
- •Identify screens and navigation.
- •Define
ViewState/Actionfor each screen; keep states serializable and testable.
- •Networking
- •Prefer
URLSession+ typed request/response models. - •Centralize auth headers, retries, and error mapping.
- •Avoid leaking raw transport errors into UI; map to domain errors.
- •Persistence
- •Choose one consistent approach: SwiftData/Core Data for structured data; UserDefaults for small prefs; Keychain for secrets/tokens.
- •Add migration strategy notes if schema evolves.
- •UI & state
- •Views should be mostly declarative; business logic lives in ViewModel.
- •Make loading/error/empty states explicit.
- •Use
@MainActorfor UI-facing state updates.
- •Performance & UX
- •Minimize unnecessary view updates; use value types,
Equatablestates where helpful. - •Images: async loading/caching; list virtualization with
Listbest practices. - •Accessibility: VoiceOver labels, Dynamic Type, sufficient contrast.
- •Quality gates
- •Unit tests for ViewModels and domain logic.
- •Snapshot/UI tests where valuable.
- •Ensure release config (entitlements, signing, privacy strings) is correct.
Output expectations when making changes
- •Keep diffs localized; avoid broad refactors unless requested.
- •Add/adjust tests when changing behavior.
- •For new features: include navigation entry, state contract, and data wiring.