Configuring the MapDataManager instance to use data from the RestaurantDataManager instance
Currently, there is an error in the MapDataManager
file. This is because the fetch(completion:)
method in your MapDataManager
class calls the initializer method that you removed from the RestaurantItem
class. You will now update the MapDataManager
class to use the RestaurantDataManager
instance as a data source, fixing the error in the process. Click the MapDataManager
file (inside the Model
folder in the Map
folder) in the Project navigator and update the fetch(completion:)
method as follows:
func fetch(completion: (_ annotations: [RestaurantItem]) -> ()){ let manager = RestaurantDataManager() manager.fetch(location: "Boston", completionHandler: { (restaurantItems) in self.items = restaurantItems completion(items) }) }
Let's break this down:
...