AQIDemo
What is it?
A demo project with VIPER architecture. All views, Interactors Presenter and routers are in place with their respective folder.
Application connects to a web socket for latest AQI data.
App provides live AQI data values for cities on listing and detail page.
On detail page we can see historical data of last 30 minutes and last 1 hour (if data is available in local sqllite db ).
We need to allow app to run for some time so that app can store data to show historical data.
App Flow
on launch in Scenedelegate router object is created and app flow starts.
Interactor connects to websocket using a library Starscream.
on receiving data from socket presenter update values based upon cities in a array.with this array presenteralways provides latest data to views.
on every 30 seconds presenter stores latest data to a local sqllite db.
Screenshots
Libraries used :
pod 'Charts'
pod 'Starscream', '~> 4.0.0'
Use of Charts :
Used Chart library to show data in bar charts.
Use of Starscream :
Used Starscream to connect websocket, library simplifies connection to a websocket.
Improved performance :
Performance improvement is done in write operation of sqllite where inserted a bunch of records in one go, instead of individual insert operation.
Gradient view For AQI :
Designed a AQIGradientView with colors of AQI and values , similar to we see in default weather app in ios 15.
Dark Mode support :
App support both light and dark modes.
How to run
git checkout and open project in xcode.