How it works...

In the previous demo, we requested data from a server in the form of a JSON response, and we parsed this response to model objects. The model objects were displayed on the screen.

We started by updating the UI so that we can have a suitable component to display the list of contacts. UITableView is the perfect component to manage the list of items due to its simplicity and efficiency in managing memory. Since we are going to parse the contacts response to model objects, we started by creating a new model struct called Contact. The JSON representation of the contact object is as follows:

    {       "gender": "female",       "name": {         "title": "ms",         "first": "anni",         "last": "nikula"       },       "location": {         "street": "8026 suvantokatu", 

Get iOS Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.