Integrating network calls within app flows
We already know how to perform a network call, parse it to data objects, and create a data store. We also know how to handle errors, and we learned that it’s important to separate the concerns into different classes and components.
However, it feels like a technical discussion. Performing a URL connection in iOS is one of the most basic tasks. Let’s try to upgrade our discussion and discuss methodology.
First, we should think of streaming data from the network as an atomic task in our app’s data synchronization mechanism. It’s up to us to decide when to call our server for more data. From our discussions, it looks like we need to contact the server just before we want to display the information, but it doesn’t have to be like that.
Let’s discuss the different strategies we can use when working with our backend. We’ll start with the just-in-time fetching technique.