-
Notifications
You must be signed in to change notification settings - Fork 0
Core Design
The app has followed
- At low level - MVVM Design
- Singleton Design Pattern
- Delegates and Protocols
There are two Managed Objects in the project
-
CityMO
-
WeatherMO
-
Data first will be received from API and then inserted into DB.
-
Data will always be displayed after successfully saved in DB.
-
ViewModel will decide what should be fed to the View
-
CityMO has one to one mapping with WeatherMO with cityId as primary key (Core data constraint)
-
Have kept both Main MOC and Private MOC for the future use (to support rollback and 'Favourite Cities's weather update)
-
Core Data Util class consists of all the operations used on CityMO and WeatherMO
Operations includes
- Saving new City + Weather -> saveCity(cityModel : CityModel , weatherModel : WeatherModel)
- Retrieve a City + Weather -> fetchCityForId
- Removing City + Weather -> RemoveCityForId
- Marking a City Favourite
- Marking a city Default -> setDefaultCityForId
- Network layer consist of APIManager responsible for Request and Response methods. (Generics used with Protocols)
- WeatherOneCallAPI use the Generic APIManager for request and response related to Weather API
- A separate class is written to provide baseURL, query params and request header
- Codable is used for data parsing
Two major views are present in the app
- WeatherHomePageViewController -> To show the Home page View
- LocationSearchViewController -> To show the list of Favourite cities
There are three custom cells available
- For favourite cities
- User to select city from search results
- Generic Custom Cell for error message
There are model classes available for each custom cell and each view All Views are on Main Queue and all ViewModel works on Global Queue
- Weather Home Page
- Location Search
- Search Results