This app shows temperature and short weather report in the current position of the user.
App is made with SwiftUI
. It has a vertical layout. In the layout there are two main parts:
- icon for the current weather
- temperature as a text
SF symbols are used to reproduce weather icons. More of the icons can be found here.
- Third party API tomorrow.io is used to get the weather information.
*The response from API is received in a nested json format. Therefore, some structs need to be to parsed with Swift’s
Codable
protocol. - API usage requres personal access key, which is received after signup.
- For this app timelines API is used.
temperature
andweatherCode
fields are received for the current hour in the response.
- User loaction upon initialization is requested. Later, every time the user location is updated we request the weather update.
- Used keys for
info.plist
file:requestWhenInUseAuthorization()
,requestAlwaysAuthorization()
- A SwiftUI project generated using Xcode 13.1 does not get separate info.plist file. Instead, keys are added in
Info tab
.
- API key is deleted from github for safety reasons. You need to create your own key so make the app work.
- Correct
line 23
inWeatherAPIClient.swift
by adding your key instead of{Key is deleted}