From the beginning of this pandemic, companies and app makers rushed in order to show countless information about the COVID situation in the world, which included the number of people infected, the number of deaths, as well as estimates about the when the vaccine would come out. However for most people, it is really hard to understand what each of these numbers mean, and how it effects themselves. I took this as an inspiration, and created a COVID app that evaluates if it is safe for the user to go outside in the user's current location, or a selected location that the user had searched, while keeping the UI simple, minimal, and easy for all types of people to understand at a single glance.
What it does
COVID Today retrieves data from the actNowCovid API, the OpenWeatherMap api, as well as from the geo.fcc api. By collecting information from these three apis, as well as through the use of several frameworks and packages, COVID Today is able to provide general information for all audiences, including how safe it is to go outside in the users location, the chance of being infected with COVID, the number of new cases in the user's location, as well as weather data, some of which proves specifically useful to certain audiences.
How I built it
This app is comprised using an MVC, or a model view controller format. The model is where most of the data is stored or retrieved from the APIs, which is then sent when requested by the view controller, which then outputs the data to the view, or what the user sees when they open the app.
For each API that is used, there is a folder in the model part of the app. In each of the folder for the API's is a model, data, and manager file. The data is first requested from the manager, which is then sent to the data file in order to be decoded. The decoded data is finally sent to the model to be converted into a string, or to be categorized.
The current location is retrieved when 1. the app first loads or 2. when the current location button is pressed. The location is retrieved as a geo-coordinate from the CoreLocation framework, which is then used to fetch weather data, as well as a FIPS code. The FIPS code is used to fetch COVID data. This is because the ActNowCovid API only takes in a FIPS code as an input. The retrieved data is then put into the UI via the View Controller. When the user presses on the search bar or the search button, the user is able to edit the search bar, and is able to type in a city name. The city is searched when the user presses go on the keyboard or when the search button is pressed a second time. Using the city name, the program retrieves the weather and covid data via the APIs that are being used
The Weather geo.fcc and COVID APIs are requested when the selected location is changed, and the Weather API is requested when the user changes the Unit System(metric or imperial) The UI and UX of this app has gone through a few stages, with modifications being made through testing the app to several friends and families. I came to the conclusion that a single view app with an emphasis on the COVID Health Risk is most useful and the best way for different users to view data at a single glance. Using the AudioToolBox Framework, I was able to create a haptic vibration when the user presses on the current location, search button, info button, or one of the F/C(Change unit) buttons. This was needed when through product testing that a haptic feedback helped the user know if their action(pressing a button) was recognized by the app.
In order to provide a few additional information about the current COVID situation that some people may still want to know, I used the PopupDialog package from Cocoapods to create a pop up with information when the info button was pressed. This was needed to provide a few more information, while keeping the design simple, and by reducing clutter in the app.
In the Table View with additional weather information, I made sure to include universal symbols and information that proves useful for certain audiences. For example, the Wind Speed and Wind Category uses knots and the Beaufort Wind system, which is hard to find in a weather or Covid App, but is remarkably useful for sailors and the navy. I also included dew point with a universal dew point symbol which is particularly useful for pilots to estimate the amount of fog and icing in the air.
After product testing, I found that I needed to find a method for the keyboard to hide, when the user presses somewhere in the app except for the keyboard. However I found this extremely hard to do at my beginner level. So to do this, after much research, I found a package from Cocoapods known as the IQKeyboardMangagerSwift that did this without having me write any code(except for importing and initializing the package in the AppDelegate).
I chose the used colors for the dark and light modes of the app by finding it the most useful and effective color choices for the user after product testing.
In order to keep all of the hyperlinks(for the API) and the names of certain strings the same, I also created a constants file in order to prevent errors from mistyping, and to keep my code clean and efficient.
Challenges I ran into
The first challenge I faced was finding a reliable way in order to fetch data from the API. Although I have had a bit of an experience with fetching data from APIs, I still struggled and wanted to give up during this period. However, by persevering and reading through Stack Overflow and the documentation, I found a way to parse the JSON data, by creating a multi-step function, which basically included a function calling another function in order to pinpoint exactly where the error was made, and what I needed to fix
The second challenge was in making the table view for the additional weather data. Since this was my first time using a table view with a set amount of data, I ran into a couple of problems. The first was in making each of the child views(the views that are repeated inside of a table view) include the symbol, name and the value. After looking through multiple articles, I found out how to make a custom child view using a swift and .xib file. Another more alarming problem was that every time, an infinite amount of child views were created in the table view. After having this in the back of my mind while working on making the UI design simple, I found a clever solution - to create a single view on top of all the unused child views, and with much tinkering, I had it work.
The third challenge was making the Unit Conversion work(changing units system). Since I could not convert all of my data every time, I decided to request for the weather api with the different system when the user pressed on a certain units system. This part was particularly a challenge since I had to have the view and the UI also update every time. In order to have them update, I used a delegate pattern to have just the table view and weather view update when the Units system was changed
Accomplishments that I'm proud of
- Finding a solution for making a set amount of child views in the table view
- Fetching data from APIs
- using Cocoapods
- making child views for the table view.
- making the unit conversion work
- using the geo.fcc API to be able to fetch COVID data from the actNowCovid API ## What I learned
- How to efficiently and reliably fetch data from APIs
- How to successfully create pod files and use Cocoapods
- How to use table Views
What's next for COVID Today
The next step for COVID Today would be releasing it to the App Store, and gaining more information and suggestions from further product testing, and using a server or finding a way to fetch data from APIs in the background(when the app is not in use). Releasing it the App Store would be the hardest, and somewhat impossible since according to the guidelines, I have to be related or part of a Health organization since information relating to the COVID-19 pandemic is considered to be sensitive.
When cloning the GitHub repository, make sure to go to the terminal, navigate to the downloaded GitHub repo, then write '''pod install''' If done correctly, this should create an .xcworkspace file of the project(the white one). The project must be run under this file in order to run correctly This is because the Cocoapods files must be downloaded to your device