- IOS16.0
- XCode Version 14.2
-
Learn is a simple iOS App built using MVVM Clean Architecture, SwiftUI and UIKit.
- Domain Layer = Entities + Use Cases + Repositories Interfaces.
- Data Repositories Layer = Repositories Implementations + API (Network) + Persistence DB.
- Presentation Layer (MVVM) = ViewModels + Views.
-
View(UI)
calls method fromViewModel
.
-
ViewModel
executes Use Case.
-
Use Case
combines data from User and Repositories.
-
- Each Repository returns data from a Remote Data
(Network)
- Each Repository returns data from a Remote Data
-
- Information flows back to the
View(UI)
where we display the lessons data.
- Information flows back to the
Presentation Layer
->
Domain Layer
<-
Data Repositories Layer
Presentation Layer (MVVM)
=ViewModels(Presenters)
+Views(UI)
Domain Layer
=Entities
+Use Cases
+Repositories Interfaces
Data Repositories Layer
=Repositories Implementations
+API(Network)
+Persistence DB
- contains Entities, FetchLessonsUseCase which fetches the lessons data.
- contains Data Repositories Interfaces which are needed for Dependency Inversion.
- Containts the ViewModels with the necessary data and its logic.
ViewModels
have all the reactivecombine
properties.Views
build withSwiftUI
andUIKit
ViewModel
Contains the view controller business logic apstracted with INPUT and OUTPUT Protocol.
-
Note
UI cannot have access to business logic or application logic (Business Models and UseCases), only ViewModels can do it. This is the separation of concerns. We cannot pass business models directly to the View (UI). This why we are mapping Business Models into ViewModel inside ViewModel and pass them to the View. -
Containts Flow
Coordinator
for presentation logic. -
Note
Flow Coordinator for presentation logic, to reduce View Controllers’ size and responsibility.
-
Contains
Repositories
Implementaion, It conforms to interfaces defined inside Domain Layer. -
Note
Data Layer conforms to interfaces defined inside Domain Layer in order to achieve (Dependency Inversion). -
Contains the
DTO
and mapping objects. -
Note
Data Transfer Objects DTO is used as intermediate object for mapping from JSON response into Domain. Also for mapping data to the persistent storage. -
Contains
NetworkTarget
that holds the apis configurations for each target
Service / Networking
- contains the base networklayerHover
.- Hover is a networking library build with
combine
. - For more about Hover please check: (https://github.com/onurhuseyincantay/Hover)