Earth Quakes With SwiftUI
EarthQuakesSwiftUI
Architecture
MVVM
Features
- EarthQuakeListings:
This view shows a list of earth quake listings fetching from a sample json.
The view model uses Combine publisher subscribe mechansim to let view know about the data fetch events and update view when data is downloaded
- FilterView:
This view has two basic filter types
1- Filter by Magnitude
2- Filter by Depth
When one of type is selected, this view sends out a notification with the type selected, and the previous view model listens to the notification and updates the earth quake list based on the filter selected
Services
- EarthQuakeService
This is responsible for fetching earth quake data
AppEnvironment
This implements two protocols.
1- Environment
A single point of access for shared services like EarthQuakeService
2- AppFactory
This implements a factory pattern to build views for the app.