Getting Started with JSON Files

In the last chapter, you configured the Map screen to display a list of restaurants using data from a .plist file. You configured custom annotations for each restaurant location and callout buttons in the custom annotations to display restaurant details when tapped. You also cleaned up and organized your code to make it easier to read and maintain.

In this chapter, you will use data in JavaScript Object Notation (JSON) format. Many apps get data from an online source using an Application Programming Interface (API) and JSON is a popular format for data hosted online.

You'll start by learning about APIs and the JSON format, and you'll create a data manager class that can load data from JSON files for use in the Lets Eat app. Next, you'll configure LocationViewController to store the location selected by the user and pass it to ExploreViewController when the Done button is tapped. After that, you'll configure ExploreViewController to pass the selected location and cuisine to RestaurantListViewController when a type of cuisine is selected. RestaurantListViewController will then be modified to get a list of restaurants from a JSON file corresponding to the selected location and cuisine and display them in the Restaurant List screen. You'll also modify MapViewController to display a list of restaurants from a JSON file based on the user's location.

By the end of this chapter, you'll know how to parse JSON data and load data from JSON files for use in your own apps. You'll also learn about UITableViewDelegate methods and ways to pass data from one view controller to another.

The following topics will be covered:

  • Getting data from JSON files
  • Using data from JSON files in your app
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.144.108