finds.dev← search

// the find

nalexn/clean-architecture-swiftui

★ 6,607 · Swift · MIT · updated Jul 2025

SwiftUI sample app using Clean Architecture. Examples of working with SwiftData persistence, networking, dependency injection, unit testing, and more.

A reference iOS/macOS app demonstrating Clean Architecture in SwiftUI: layered into Presentation, Interactors (business logic), and Repositories (data access), with a Redux-style AppState as the single source of truth. Aimed at iOS devs who've outgrown MVVM spaghetti and want a concrete, non-trivial example of DI, async networking, and SwiftData persistence rather than a blog post's toy snippet.

The DI is native SwiftUI (@Environment-based), not a third-party container, so you can actually follow how objects get wired without learning another framework. Test coverage is real and includes UI tests via the author's own ViewInspector library, plus mocked web/DB repositories — this is one of the few sample projects that shows how to unit test SwiftUI views at all. The project has been kept current (SwiftData, async/await, revamped end of 2024) rather than frozen as a 2020-era Combine relic, and the mvvm branch gives a direct architectural A/B comparison in the same codebase.

It's a single-screen countries list/detail app — the architecture is proven at toy scale, not at the scale where Clean Architecture's ceremony actually pays for itself (many features, many teams). The AppState-as-single-source-of-truth pattern will get unwieldy fast in a real app; there's no guidance here on splitting state or handling large AppState graphs. CI is still on Travis, which is effectively dead — no evidence the build is actually verified on modern Xcode/toolchains. And this is fundamentally one developer's opinionated take on 'Clean Architecture' (Uncle Bob's term is used loosely) — treat it as one solid pattern to steal ideas from, not a canonical or validated approach.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →