First, it took me a bit more time than I expected :) But it became so interesting I decided to put an extra effort into the project
- SOLID being followed
- README
- Test coverage (83.6%)
- Dark/Light (No extra effort needed for SwiftUI)
- Forecast react on location change (the filtered distance is 5km and works only when current location is chosen)
- Supporting multiple temperature units (Networking layer has it, although I didn't manage to include it to the presentation layer)
Morning | Noon | Evening | Cloudy evening |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
- SwiftUI with MVVM for presentation layer
- Clean architecture and generic networking layer
- async await for the networking layer, Combine (obviously) for presentation layer
- Auto-generated mocks, DI Container, Snapshot tests
Here I have 2 trade-offs I had to make in order to accomplish the task:
- Since somehow SwiftUI was appearing through
WeatherApp
I had to disableonAppear
logic for unit tests specifically - Just for a demo and a better code coverage
CurrentWeatherViewModel
is tested although easier one -LocationSearchViewModel
isn't.
The whole networking layer is tested. Therefore, code coverage is 83.6% only.
I've used following articles to get inspired by:
- Mockolo - auto-generated Mocks by Uber with Spy method that helps to track down amount of calls
- Factory - DI manager
- Swift Snapshot testing - library for make it easy to have snapshot tests