Create a two screen weather app which shows current location weather details and next 7 days forecast.
Use open weather public API to get current weather and next 7 days forecast details. Use the attached API key to call “4cd569ffb3ecc3bffe9c0587ff02109f”, you can also sign up to create a new free API key.
Current weather using device coordinates:
Response: { "coord": { "lon": -122.08, "lat": 37.39 }, "weather": [ { "id": 800, "main": "Clear", "description": "clear sky", "icon": "01d" } ], "base": "stations", "main": { "temp": 282.55, "feels_like": 281.86, "temp_min": 280.37, "temp_max": 284.26, "pressure": 1023, "humidity": 100 }, "visibility": 16093, "wind": { "speed": 1.5, "deg": 350 }, "clouds": { "all": 1 }, "dt": 1560350645, "sys": { "type": 1, "id": 5122, "message": 0.0139, "country": "US", "sunrise": 1560343627, "sunset": 1560396563 }, "timezone": -25200, "id": 420006353, "name": "Mountain View", "cod": 200 }
To display Next 7 days forecast
Response:
{ "city":{ "id":2643743, "name":"London", "coord":{ "lon":-0.1258, "lat":51.5085 }, "country":"GB", "population":0, "timezone":3600 }, "cod":"200", "message":0.7809187, "cnt":7, "list":[ { "dt":1568977200, "sunrise":1568958164, "sunset":1569002733, "temp":{ "day":293.79, "min":288.85, "max":294.47, "night":288.85, "eve":290.44, "morn":293.79 }, "feels_like":{ "day":278.87, "night":282.73, "eve":281.92, "morn":278.87 }, "pressure":1025.04, "humidity":42, "weather":[ { "id":800, "main":"Clear", "description":"sky is clear", "icon":"01d" } ], "speed":4.66, "deg":102, "gust": 5.3, "clouds":0, "pop":0.24 }, ....
- Show current location weather details in home screen
- Use collection view to display 7 days forecast
- On click of next days button, navigate to forecast screen to display next 7 days forecast details
- Expected to follow MVC architecture.
- Expected to Design the UI as close as possible.
In blue card, show current weather details like
- Cloud image can be changed by referring weather -> main key from above json
- main -> temp is to show current temperature in Fahrenheit, convert Fahrenheit to Celsius
- wind -> speed is used for wind speed
- Main -> feels_like is used to for feels like which is in Fahrenheit, convert Fahrenheit to Celsius
- Instead of UV index, please show sys -> sunrise, convert timestamp to Date object to display the date in hh:mm
- main -> pressure to display pressure
- Under blue card use the collection view to display 7 days forecast details by call forecast API and the first cell in the collection view should display current day’s weather and time in hh:mm format.
- Use hourly -> dt key to display the hourly date in collection view in hh:mm format
On click on next 7 days button, navigate to forecast details button and use table view to display all 7 forecasts using daily key from forecast API
- Use dt key to display the date in EEEE, dd MMM
- For Max temp temp -> Max, Min temp temp -> Max,both values are in Fahrenheit which needs to convert to Celsuis