
SwiftUI Cookbook
By :

A common characteristic that most mobile apps have is that they fetch data from a remote web service. Given the asynchronous nature of the problem, it is often problematic when this is implemented in the normal imperative world. However, it suits the reactive world nicely, as we'll see in this recipe.
We are going to implement a simple weather app, fetching the current weather and a 5-day forecast from OpenWeather, a famous service that also has a free tier.
After fetching the forecast, we will present the results in a list view, with the current weather fixed on the top.
We will start by creating a SwiftUI app called Weather
.
To use this service, we must create an account on OpenWeather:
Figure 10.7 – OpenWeather signup page