In this exercise you are going to rewrite the restaurant ordering example as a SwiftUI app. Your SwiftUI version will have all of the same features of the original app.
Write a simple app that implements a menu and ordering for a restaurant. The main view of the app will display a list of menu items. Clicking on one of the items in the list shows a more detailed description of the item:
Clicking the Order button adds the selected item to the user's order.
Clicking the View Order item in the navigation bar triggers a segue to a second view that displays the user's current order.
Here is the code for a couple of the classes you will need:
struct MenuItem { let title : String let description: String init(title t : String,desc d : String) { title = t description = d } } class CafeModel { var items : [MenuItem] var order : [MenuItem] init() { items = [] items.append(MenuItem(title:"Hamburger",desc: "Two all beef patties, pickles, and lettuce on a sesame seed bun")) items.append(MenuItem(title: "French Fries", desc: "Chunky fries made from the finest Idaho potatoes")) items.append(MenuItem(title: "Garden Salad", desc: "Lots of iceberg lettuce and ranch dressing")) items.append(MenuItem(title: "Apple Pie", desc: "Made with fresh locally grown apples")) items.append(MenuItem(title: "Tacos", desc: "We got these from Taco Bell next door")) order = [] } }