Creating LocationDataManager

Like you did in the previous chapter, you will create a data manager class to load the location data from Locations.plist and provide it to LocationsViewController. To create the data manager class, follow these steps:

  1. Right-click the Model folder in the Location folder and select New File.
  2. iOS should already be selected. Choose Swift File and click Next.
  3. Name this file LocationDataManager and click Create.
  4. After the import statement, type in the following to declare the LocationDataManager class:
class LocationDataManager {}
  1. Inside the curly braces, add the following property to hold the list of locations:
private var locations:[String] = []

The private keyword means that the locations property may only be ...

Get iOS 13 Programming for Beginners - Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.