Creating the LocationDataManager class
As what you’ve done in the previous chapter, you’ll create a data manager class to load the location data from Locations.plist and provide it to the LocationsViewController instance for the Locations screen. The data will then be used to populate the table view in the Locations screen. Follow these steps:
- Right-click the
Modelfolder in theLocationfolder and select New File. - iOS should already be selected. Choose Swift File and click Next.
- Name this file
LocationDataManagerand click Create. - Click on the
LocationDataManagerfile in the Project navigator and after theimportstatement, type in the following to declare theLocationDataManagerclass:class LocationDataManager { } - Inside the curly braces, add an array property,
locations, to hold the list of locations:private var locations: [String] = []The
privatekeyword means that thelocationsproperty may only...