Yet Another Clean Architecture iOS
YACAI is a project showing Yet Another Clean Architecture iOS approach.
An original idea and description (Robert C. Martin)
Branch | Description |
---|---|
main | SwiftUI, Combine |
rxswift | UIKit, RxSwift |
async_uikit | UIKit, async/await |
Also, the project uses Resolver (DI framework).
Clean architecture is all about layers. One suggests using the following layers.
Any lower layer is dependent on a higher layer. When a higher layer uses a lower layer we create a protocol on the higher layer and put the implementation to the lower layer. That way the higher layer dictates his rules to the lower layer (we force to use dependency inversion principle).
For example, we need a use case using a repository. For that, we have repository protocols in Domain/Repository but repository implementations are located in Data/Repository. So, Domain can use Data but Data is dependent on Domain.
The architectural approach is demonstrated on a very simple client of open academic journal PLOS
The application has unit tests.
We test:
- UI (only view models)
- Domain
- Data (excepting the DTO mapper)
We don't test:
- Views in UI because for that UI tests are more suitable
- Platform because is often just adapters for different external frameworks