``` // // ContentView.swift // Form Updating Example // // Created by Sahand Nayebaziz on 12/10/20. // import SwiftUI struct ContentView: View { @State var isPresentingMainView = false @State var favoriteFood: FoodType = .bagel var body: some View { VStack { Button(action: { isPresentingMainView = true }, label: { Text("Present Main View") }) } .fullScreenCover(isPresented: $isPresentingMainView) { MainView(favoriteFood: $favoriteFood) } } } struct MainView: View { @Binding var favoriteFood: FoodType var body: some View { NavigationView { HStack { Spacer() Text(favoriteFood.emoji) .font(.title) .foregroundColor(.secondary) Spacer() NavigationView { Form { List { ForEach(["SomethingRepresentingShowingFood"], id: \.self) { _ in NavigationLink( destination: makeDetail(), label: { Text("Food Randomizer") }) } } } } .navigationViewStyle(StackNavigationViewStyle()) .frame(maxWidth: 350) } .navigationTitle("Main") .navigationBarTitleDisplayMode(.inline) } .navigationViewStyle(StackNavigationViewStyle()) } func makeDetail() -> some View { Form { ForEach(FoodType.allCases) { foodType in Button(action: { favoriteFood = foodType }, label: { HStack { Text(foodType.emoji) Spacer() if favoriteFood == foodType { Image(systemName: "checkmark") } } }) } } } } enum FoodType: String, Identifiable, CaseIterable { case bagel, pizza, broccoli var id: String { rawValue } var emoji: String { switch self { case .bagel: return "🥯" case .pizza: return "🍕" case .broccoli: return "🥦" } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { Group { ContentView() MainView(favoriteFood: .constant(.bagel)) MainView(favoriteFood: .constant(.bagel)) .makeDetail() } } } ```