Passing data between view controllers
So, the next part of our app is to pass some data over to our new details view but to do this, we need to create a new View Controller and hook up our labels and images to some outlets.
The code that fetches contact information also needs to be updated too, so a contact's phone number, email address, and postal address are fetched.
Finally, the contact data needs to be passed from the overview to the details page so the details page can display the data. The steps involved in this process are the following:
- Updating the data loading
- Passing the model to the details page
- Updating our outlets
- Best practices (creating a view model)
Let's now go through each step.
Updating the data loading
Currently, the code in ViewController.swift
specifies that just the given name, family name, image data, and image availability for a contact should be fetched.
This needs to be expanded so the email address,...