Weather Forecast Assigment - iOS - MVP + Clean Architecture
Weather Forecast Assigment – iOS – MVP + Clean Architecture
Description
Weather Forecast Assigment is an iOS application built to highlight MVP (Model View Presenter) and Clean Architecture concepts
Run Requirements
- Xcode 12+
- Swift 5
High Level Layers
MVP Concepts
Presentation Logic
View
– delegates user interaction events to thePresenter
and displays data passed by thePresenter
Presenter
– contains the presentation logic and tells theView
what to presentConfigurator
– injects the dependency object graph into the scene (view controller)
Clean Architecture Concepts
Application Logic
UseCase / Interactor
– contains the application / business logic for a specific use case in applicationEntity
– plainSwift
classes / structs
Gateways & Framework Logic
Gateway
– contains actual implementation of the protocols defined in theApplication Logic
layerPersistence / API Entities
– contains framework specific representations
Assignment Application Details
- Overview what I have to do in the assignment application:
- Load data weather, display on view.
- Check search input to make sure the keywords more than three characters berfore trigger search request.
- Check if search request have from Cache (CoreData) before request to the server. This to prevent the request calling to the server at the same time with same request.
- Make new search request to get newest data from server.
- Hande error from server response.
- Store the request & response to CoreData.
- Accessibility supports:
- Scaling text if supported to change the font size.
- The screen reader is enable by VoiceOver.
- Following MVP-Clean Architecture, I have been written:
WeatherPresenter
– Return weather data to display on screen, valid input,…SearchWeatherUserCase
– Referenced withWeatherPresenter
to process the search weather by city name feature, it manipulatesWeathers Entity
and comunicates withWeatherGateway
to retrive / persist the weathers entity.WeatherGateway
– Implementation of the protocols defined from Use Cases layer.ApiWeatherGateway
– Using URLSession to request data from server.LocalPersitenceWeatherGateway
– Using CoreData to fetch weather data storaged.
Weather
entity – Contains specific representations, includes:ApiWeatherRequest
,ApiWeatherResponse
,Weather Entity
from CoreData.
ToDo
- Unit Tests
- UI Tests
Check List
- The application is a simple iOS application that is written by Swift.
- The application is able to retrieve the weather information from OpenWeatherMaps API.
- The application is able to allow user to input the searching term.
- The application is able to proceed searching with a condition of the search term length must be from 3 characters or above.
- The application is able to render the searched results as a list of weather items.
- The application is able to support caching mechanism so as to prevent the app from generating a bunch of API requests.
- The application is able to manage caching mechanism & lifecycle.
- The application is able to handle failures.
- The application is able to support the disability to scale large text for who can’t see the text clearly
- The application is able to support the disability to read out the text using VoiceOver controls.