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:
Right-click on the
Model
folder in theLocation
folder and select New File.Inside of the Choose a template for your new file screen, select iOS at the top and then Swift File. Then, hit Next.
Name this file,
MapDataManager
and then hit Create.Next, we need to define our class definition, so add the following under the import statement:
class MapDataManager {}
Inside of the class declaration, add the following variables:
fileprivate var items:[RestaurantAnnotation] = [] var annotations:[RestaurantAnnotation] { return items }
Note that we are keeping our array private, since there is no reason to have to access this outside of the class.
Now, let's add the following methods inside of our class declaration, after our variables:
func fetch...