Completing the Restaurant Detail screen
You now have a SwiftUI map view displaying a map. Now, you'll create a new SwiftUI view to represent the Restaurant Detail screen and add the map view to it. Follow these steps:
- Choose File | New | File to open the template selector.
- iOS should already be selected. In the User Interface section, click SwiftUI View and click Next.
- Name the new file
RestaurantDetail.swift
and click Create.RestaurantDetail.swift
appears in the Project navigator. - Declare and define the
RestaurantDetail
andRestaurantDetail_Previews
structures, as shown:import SwiftUI struct RestaurantDetail: View { var selectedRestaurant: RestaurantItem var body: some View { VStack { MapView(lat: selectedRestaurant.lat , long: ...