Creating our Map Data Manager

In the next chapter, we will deal with data, but for now, we can mock up some data in order to set up our structure. We will use a plist to load our data, just like we did in the last chapter.

Let's create the MapDataManager file now:

  1. Right-click on the Model folder in the Location folder and select New File.
  2. Inside of the Choose a template for your new file screen, select iOS at the top and then Swift File. Then, hit Next.
  3. Name this file, MapDataManager and then hit Create.
  4. Next, we need to define our class definition, so add the following under the import statement:
    class MapDataManager {}
  5. Inside of the class declaration, add the following variables:
    fileprivate var items:[RestaurantAnnotation] = [] var annotations:[RestaurantAnnotation] ...

Get iOS 10 Programming for Beginners 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.