vuinguyen / FishingDaze

A fishing journal app to document fishing trips, built for my capstone project, for my Udacity iOS Nanodegree program.
1 stars 1 forks source link

Journal Entry Screen: Weather Section #8

Closed vuinguyen closed 4 years ago

vuinguyen commented 5 years ago

Here we grab data from a weather API.

If that is not possible, allow user to manually add weather data.

vuinguyen commented 5 years ago

Udacity mentor Phuong recommended selecting an API that requires an API key (said not necessary but a good practice) and uses HTTPS

vuinguyen commented 4 years ago

I plan to use weatherbit.io for the Weather API. To use this API, we'll need the following info:

For now, I think the following use cases will need to be handled:

-- The current weather API does not need date and time info in the query parameters of the REST call, but it will still need location. This will still simplify calling the current weather API immensely.

Below is an example of the Journal Editing window: EditScreen

vuinguyen commented 4 years ago

One thing I could do, which would be a great use of NSUserDefaults, issue #11, is store the use of Fahrenheit or Celsius for temperature, in user defaults.

vuinguyen commented 4 years ago

I've modified the UI for the weather feature, in anticipation of displaying the weather data from Weatherbit.io . I've also been experimenting with the Weatherbit.io API in a separate playground. Getting ready to integrate that code into the app soon. Baby steps ...

WeatherFeatureUI

vuinguyen commented 4 years ago

Right now, the "Get Current Weather" button only works if you tap on "Get My Location" button first and get the location. Because the Weather API requires a location to work.

This is what it looks like when the "Get Current Weather" function is successfully called: Simulator Screen Shot - iPhone 8 Plus - 2020-01-10 at 16 17 18

More testing will need to be done to ensure that all the CRUD operations for Weather, esp. with regards to Core Data, works correctly. Also, I haven't decided yet if I will implement other use cases to fill the Weather boxes (ie allow the weather feature to call geolocation as a nested asynchronous call with the weather API, instead of requiring that gelocation be called prior to the weather API call using the "Get My Location!" button) now or later after submitting my project for Udacity review.

Still, this progress was a long time coming, so I will take a break for now and briefly celebrate.

vuinguyen commented 4 years ago

Example of JSON coming back from the Weatherbit.io API call:

Screen Shot 2020-01-10 at 4 19 52 PM
vuinguyen commented 4 years ago

When I'm ready to go back and work on the weather /location feature again, here are a couple of helpful links for reference: https://developer.apple.com/documentation/corelocation/converting_between_coordinates_and_user-friendly_place_names

https://developer.apple.com/documentation/corelocation/clgeocoder

vuinguyen commented 4 years ago

I am calling this issue done for now. The other use cases / ways to implement Weather I may do after my project has been reviewed.