In the previous chapter, we learned how to route requests, how to use controllers, and how to make RESTful routes for our models that will persist data into the MongoDB database. In this chapter, we will consume the API routes we just created in our Shopping List iOS app. Most modern iOS applications need to communicate with a server to fetch data to show on the app. They also update data on the server so that you can start where you left off in case the app is closed or you try to view the app on a different device or platform, such as the web. To make such seamless integration work, we need to ask the server for the data and have all of the data persisted remotely.
In this chapter, we will switch back to working on our iOS app written in Swift. We will focus on how we can refactor our project so that we can run both the Vapor server and the iOS in one...