Tengo 2 números Enteros: Xcode y Ycode. Estos son los enlaces de las pantallas anteriores. Ahora lo que quiero es presentar un nuevo punto de vista basado en estos enteros.
La aplicación es un pequeño examen. Así que el Xcode y Ycode son la partitura. Pero quiero presentar un nuevo punto de vista cuando usted haga clic en el botón "Click me", basada en el Xcode y Ycode.
Por ejemplo:
Value X = between 8-15 and value Y = between 8-23 -> present screen1
Value X = between 8-15 and value Y = between 24-40 -> present screen2
Value X = between 16-23 and value Y = between 8-17 -> present screen3
And so on......
This is my Code:
@Binding var Xcode: Int
@Binding var Ycode: Int
@State var ShowButton: Bool = false
@State var ButtonYes: Bool = false
@State var ButtonNo: Bool = false
@State var ButtonSometimes: Bool = false
var body: some View {
ZStack{
Image("Zebras")
.resizable()
.ignoresSafeArea()
.navigationBarHidden(true)
VStack{
Text("Wat ben ik?")
.font(.largeTitle)
.fontWeight(.heavy)
.padding()
.foregroundColor(.white)
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
Spacer()
Text("Je heb alle vragen beantwoord. Nu is de vraag: Welk dier ben ik?")
.foregroundColor(Color.white)
.font(.headline)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
Spacer()
Text("Your score:")
.foregroundColor(Color.white)
.font(.headline)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
HStack (spacing:0){
Text("X = ")
.foregroundColor(.white)
.font(.largeTitle)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
Text(String(Xcode))
.foregroundColor(.white)
.font(.largeTitle)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
}
HStack (spacing:0){
Text("Y = ")
.foregroundColor(.white)
.font(.largeTitle)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
Text(String(Ycode))
.foregroundColor(.white)
.font(.largeTitle)
.padding()
.background(Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
}
Spacer()
Button("Click here!") {
}
.frame(width: 100, height: 50, alignment: .center)
.font(.headline)
.foregroundColor(.white)
.padding()
.background(ButtonYes ? Color(red: 0.272, green: 0.471, blue: 0.262) : Color(red: 0.493, green: 0.184, blue: 0.487))
.cornerRadius(20)
.shadow(color: .black, radius: 10, x: 10, y: 10)
Spacer()
}
}
}
}
¿Cómo puedo crear?