Debugging the app and server side by side
One of the benefits of using Xcode and Swift for both frontend and backend development is the ability to develop and debug both iOS and Vapor apps at the same time. To see this in action we need to do the following:
- Open
ShoppingListController.swift
in the server project and put a breakpoint by clicking on the line number that is inside the index method, as follows:
- Go to the
ShoppingList.swift
model in our iOS project and click on the line inside the completion handler of the request so we can inspect the response we get back from the server, as follows:
- Trigger a request to fetch the data again from the app by pulling down on the table view:
Once you have triggered a refresh by pulling down on the table view, you would have seen the Xcode pause execution at the line where we put the breakpoint in the index method of the Shopping List controller. Here we can inspect the req
and print objects in the console, if needed, to help us debug an issue and...