Development · GitHub repo

clean-architecture-swiftui

Sample SwiftUI app demonstrating Clean Architecture with modern Swift patterns

Visit github.com ↗

An open-source reference project by Alexey Naumov illustrating how to implement Clean Architecture in SwiftUI applications. It demonstrates clear separation of concerns across presentation, business logic, and data layers using modern Apple tooling like SwiftData, async/await, and Swift Testing.

What it's for

  • Structure production SwiftUI apps with separated presentation and data layers
  • Study best practices for SwiftData persistence and async/await networking
  • Implement programmatic navigation and deep linking in SwiftUI
  • Set up comprehensive unit and UI tests using ViewInspector and Swift Testing

Features

  • Decoupled Presentation, Business Logic (Interactors), and Data Access (Repositories) layers
  • Centralized AppState acting as a single source of truth
  • Native dependency injection using SwiftUI Environment
  • Data persistence powered by SwiftData
  • Networking layer built using async/await
  • Programmatic navigation supporting deep linking
  • Unit and UI test coverage with Swift Testing and ViewInspector

Pricing

Open source

Details

Type
GitHub repo
Category
Development
Topic
App Architecture
Open source
Yes
Platforms
iOS, macOS
For
iOS and macOS developers building SwiftUI applications
Alternative to
The Composable Architecture (TCA)
Tags
swift, swiftui, clean architecture, swiftdata, ios, testing

Why it was saved

  • @nallexn, 8 December 2024: A canonical reference for structuring SwiftUI apps with Clean Architecture, recently revamped to modern tooling: SwiftData for persistence, async/await replacing Combine, Swift Testing replacing XCTest, and @main App lifecycle.

Related

Updated