Screen.Recording.2023-12-11.at.3.10.57.PM.mov
This project aims to develop a demo iOS application to demonstrate the usage of WeatherService
SDK and how it utilizes it to build features on top of it
The screen shows the list of predefined locations. Currently, they come from local JSON file and are subsequently cached. In the future change, they can also be fetched from the remote URL
The screen that shows the favorited locations
A screen that shows the current temperature and the temperatures for the next 7 days. This includes minimum, maximum, and average temperature. Alternatively, users can also switch between celsius/fahrenheit units
The app uses Core data for caching user content and models. For example, when the user favorites individual locations, this is persisted across app restarts.
Also, whenever the user favorites a location, the current and forecasted temperature details will be cached.
The bookmarked location is automatically cached and is removed when the user unbookmarks the item. While getting a forecast, the app first tries to download data from the network. If that call fails due to an unavailable network, the app retrieves the forecast data from the previously stored cache.
The app uses MVVM-Router architecture. The reason is, that I wanted to separate out all the business and data transformation logic away from the view layer.
The view model is responsible for getting models from the WeatherService
API and converting them into local view models to be consumed by the view layer.
I ruled out MVC due to it polluting the view layer and making it difficult to just test the business logic due to intermixing with a view.
I also thought about VIPER architecture, but I avoided it due to the unnecessary boilerplate code during implementation.
Finally, I decided to use MVVM as a middle ground between these two possible alternatives.
The MVVM-Router architecture applies to all the app screens. Namely, there are 4 components in this architecture with a brief description
-
View - Responsible for laying out
UIKit
elements on the screen -
ViewModel - The layer responsible for applying business logic to the network models
-
Model - The models received from the network or the SDK
-
Router - Also called as a coordinator. Responsible for routing and navigation within the app
The app can be run simply by opening "WeatherServiceDemo.xcodeproj" file and pressing CMD + R to run it
Due to time constraints, I haven't written any tests for the demo app. However, the code is structured so that it can be easily unit-tested.
I performed the manual testing on the app before submission handling all features and edge cases. Namely following functionalities are tested
-
Showing locations list
-
Favoriting location
-
Caching support
-
Offline viewing of bookmarked locations
-
Favorites list
I haven't added any UI/Automated tests due to time limitations. If I have extra time, I will write extra E2E tests to verify the app flow
This app is currently supported only on iPhone (Any model) in portrait and landscape mode.
I am not using third-party images in the app
I am not using any 3rd party library in this app.
The app needs a minimum version of iOS 15 for the deployment
The app was compiled and run on Xcode version 15.0
I am using Weather Service SDK to get the weather forecast information for the selected location.
The detailed guide on using this API can be found in README file
The project can be extended in several ways in the future
-
Comprehensive unit and UI tests
-
Support for cache flush in case of a large number of locations
-
Accessibility
-
Support for showing forecast at the current location
Swift 5.0