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 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.