Browse Source

first navigation with a vstack heads or tails

main
art.dambrine 4 years ago
parent
commit
a7b73deddc
  1. 28
      NavigationExemple/ContentView.swift

28
NavigationExemple/ContentView.swift

@ -7,10 +7,34 @@
import SwiftUI import SwiftUI
struct ResultView: View {
var choice: String
var body: some View {
Text("You chose \(choice)")
}
}
struct ContentView: View { struct ContentView: View {
var body: some View { var body: some View {
Text("Hello, world!") NavigationView{
.padding()
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")
}
} }
} }

Loading…
Cancel
Save