Adding data to the .plist file

As you saw in the previous chapter, ExploreData.plist stores data as an array of dictionaries. In this section, you will configure Locations.plist so that it stores data for the Locations screen in the same format and then add all the restaurant locations to it. Follow these steps to do so:

  1. Click on Dictionary in the .plist file and change it to Array. Note that the disclosure triangle on the left should be pointing down. Click the + button:

  1. A new item, Item 0, will be added to the array. Change the type to Dictionary. Click the disclosure triangle to make it point down. Click the + button, as shown in the following screenshot:


  1. A new item, New Item, will be added to the Item 0 dictionary. Click the + button, as shown in the following screenshot:


  1. A second item will be added to the Item 0 dictionary. For the first item, change the key to city and the value to Aspen. For the second item, change the key to state and the value to CO:


  1.  Click the disclosure triangle next to the Item 0 dictionary to collapse it:


  1. Select Item 0 and press command + C on the keyboard to copy it and command + V to paste. You will see a new item, Item 1:


  1. Click the disclosure triangle next to the Item 1 dictionary to expand it. Update the city to Boston and the state to MA:

  1. Continue with the same process by adding the following cities and states:
Item City State
Item 2 Charleston NC
Item 3 Chicago IL
Item 4 Houston TX
Item 5 Las Vegas NV
Item 6 Los Angeles CA
Item 7 Miami FL
Item 8 New Orleans LA
Item 9 New York NY
Item 10 Philadelphia PA
Item 11 Portland OR
Item 12 San Antonio TX
Item 13 San Francisco CA

 

The completed .plist file should look like this:

The Locations.plist file is complete. Now, you will create a data manager class, similar to the one you made in the previous chapter, which will read the Locations.plist file and provide it to LocationViewController.

..................Content has been hidden....................

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