Creating the RestaurantItem class

To represent restaurant locations on the Map screen, you will create a class, RestaurantItem, that conforms to MKAnnotation. When RestaurantItem objects are added to a map view, the delegate object (usually a view controller) of the map view will automatically provide MKAnnotationView, which appears as a pin, on the map view.

You need the location of the restaurant so that you can set the coordinate property of the RestaurantItem instance. The restaurant location data will be provided as a .plist file. Before you create the RestaurantItem class, you need to import the .plist file containing the restaurant details into your app. Do the following steps:

  1. Open the LetsEat project. In the Project navigator, right-click ...

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

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