SwiftUI-Clean-Architecture-example-with-unit-tests

This is a small project that gets a TODO list from the network, stores it with Filemanager and shows it in a SwiftUI list.

Overview

The project was developed with the following concepts in mind:

  • No external libraries
  • SOLID principles
  • Clean Architecture
  • MVVM Architecture
  • Use of Composition root
  • Coordinator Pattern: Uses UIKit UINavigationController + UIHostingController for navigation
  • Factory Pattern
  • Repository Pattern
  • Use Cases
  • Async Await + Result APIs
  • Dependency Injection
  • Unit tests: Although TDD was not used, tests were created after each instance creation
  • Test doubles: Use of Stubs, Spys and Mocks
  • Test for memory leaks
  • Folder separation: Domain, Data, Presentation and Framework

Dependency Diagram:

Clean MVVM SwiftUI

Disclaimer:

This is a very basic project to serve as guide for a tested Clean Architecture approach with SwiftUI.

  • Feedback is welcomed.
  • I might add some more use cases and features in the near future.
  • TODO entity was used throughout the app for simplification sake. True modularity would be achieved by mapping it between layers.

Useful resources that made this possible:

GitHub

View Github