Goat_Challenge is an application architectured with MVP and Clean Architecture concepts Functionalities: Fetch weather data from OpenWeatherAPI and display onto the UITableView.
-
Model
- plainstruct
implementations- In this project, it was used to directly be as what to displayed on UITableView
- The logic to fetch or modify the model entity is one of the responsibilities for
Model
layer but was introduced inside theusecase
orgateways
layer in Clean Architecture
-
View
-protocol
defines user interactions and how to display data.UIView
instance only cares about layouts and by conformingView
protocols, the instance can display what we want.
-
Presenter
- contains the presentation logics.- Handle specific busniess logic for user interactions, like
UITableView.didSelectRowAt
. - Initiate the call to fetch
Model
. - Tells the
View
what to be displayed
- Handle specific busniess logic for user interactions, like
-
ViewController
- In this project, it is considered as part of theView
layer,- However, we can seperate ViewController and View by wrapping the UITableView with its own MVP pattern. Then ViewController instances only responsible to handle the layout, lifecycle management, and routing.
Application Logic
Usecase/ Interactor
- contains the exact busniess logic for specific use case.Gateway
protocol inside Core Group to define overall methods.Usecase
as the concrete instance to implement. For example, we can have aUserGateway
define different login methods and we have multipleUsecase
to implement different login methods.Presenter
in MVP reference theUsecase
.- Manipulate the
Model
if needed as part of the business logic.
Gateways & Framework Logic
Gateway
- acutal implementation of protocols defined in Application Logic.APIGateway
used to perform requests through http request- More example, such as
LocalPersistasnceGateway
to interact with the local database.
- Unit test for
Model
,Usecase
, concreteGateways
andAPIClient
LocalPersistantLayer
to store and fetch the Weather data. Therefore we can have the flow of requesting weather data by going though http request, then check CoreData, and lastly load the mock.json file.- Should cover a usecase for 'GCLocationManager' to fit the general structure for the application.
- Error handling cases.