From a7b73deddc021791a208468c0d3fa95772648304 Mon Sep 17 00:00:00 2001 From: "art.dambrine" Date: Tue, 6 Apr 2021 09:45:31 +0200 Subject: [PATCH] first navigation with a vstack heads or tails --- NavigationExemple/ContentView.swift | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/NavigationExemple/ContentView.swift b/NavigationExemple/ContentView.swift index 160e0f0..4d95fe4 100644 --- a/NavigationExemple/ContentView.swift +++ b/NavigationExemple/ContentView.swift @@ -7,10 +7,34 @@ import SwiftUI +struct ResultView: View { + var choice: String + + var body: some View { + Text("You chose \(choice)") + } +} + struct ContentView: View { var body: some View { - Text("Hello, world!") - .padding() + NavigationView{ + + VStack(alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/, spacing: 20){ + + NavigationLink( + destination: ResultView(choice: "Heads")){ + Text("Chosing Heads") + .padding() + } + + NavigationLink( + destination: ResultView(choice: "Tails")){ + Text("Chosing Tails") + .padding() + } + }.navigationTitle("Menu principal") + } + } }