iOS App Architecture (dummy)
The iOS app is built in Swift with SwiftUI on the surface and a plain old model layer underneath.
Layers
- View — SwiftUI. Stateless where possible.
- ViewModel —
ObservableObject. Owns state, formats data for the view. - Repository — async functions returning domain models. No UI concerns.
- Network / Storage — the lowest layer, talks to the API and local cache.
Navigation
We use a single NavigationStack per tab, driven by a typed enum of destinations. Deep links resolve to the same enum so the navigator code stays honest.
Testing
- ViewModels are tested with plain unit tests — no UI runtime.
- Repositories are tested against an in-memory fake network.
- Snapshot tests cover visual regressions on the most-used screens.
Keep business logic out of views. A view should be a function of state; anything harder than that belongs one layer down.