Passing data to the Restaurant Detail screen

The Map screen now displays restaurant annotations. When you tap an annotation's callout button, the Restaurant Detail screen appears, but it does not contain any data about the restaurant. To pass restaurant data to the Restaurant Detail screen, you need to get the data from a RestaurantItem instance to the view controller in charge of the Restaurant Detail screen, which has not been created yet. Let's create it now:

  1. Right-click the RestaurantDetail folder and select New File.
  2. iOS should already be selected. Choose Cocoa Touch Class and then click Next.
  3. Configure the file as follows:
  • Class: RestaurantDetailViewController
  • Subclass: UITableViewController
  • Also create XIB: Unchecked
  • Language:

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.