import SwiftUI
struct ContentView: View {
private var symbols = [“food1”, “food2”, “food3”]
@State private var numbers = [1, 2, 0, 3]
@State private var credits = 1000
private var betAmount = 5
var body: some View {
ZStack {
var debug: some View {
MyViewWithError(property: self.property)
}
//Background:
Circle()
.foregroundColor(Color (red: 90/255, green: 200/255, blue: 250/255))
.edgesIgnoringSafeArea(.all)
Circle()
.foregroundColor(Color (red: 250/255, green: 45/255, blue: 85/255))
.rotationEffect(Angle(degrees: 45))
.edgesIgnoringSafeArea(.all)
.shadow(radius: 10)
.overlay(Circle().stroke(Color.yellow, lineWidth: 5))
VStack {
Spacer()
//Title:
HStack {
Image(systemName: "sun.min")
.foregroundColor(.black)
Text("Eatable Turbine")
.bold()
.foregroundColor(.white)
Image(systemName: "sun.min")
.foregroundColor(.black)
}.scaleEffect(2)
Spacer()
//cards
HStack {
Spacer()
Image(symbols[numbers[0]])
.resizable()
.aspectRatio(1, contentMode: .fit)
.background(Color.white.opacity(0.5))
.cornerRadius(10)
Image(symbols[numbers[1]])
.resizable()
.aspectRatio(1, contentMode: .fit)
.background(Color.white.opacity(0.5))
.cornerRadius(10)
Image(symbols[numbers[2]])
.resizable()
.aspectRatio(1, contentMode: .fit)
.background(Color.white.opacity(0.5))
.cornerRadius(10)
Image(symbols[numbers[3]])
.resizable()
.aspectRatio(0.5, contentMode: .fit)
.background(Color.white.opacity(0.5))
.cornerRadius(20)
Image()
.frame(width: 32.0, height: 32.0)
Spacer()
}
Spacer()
//Button
Button(action: {
//Change the images
self.numbers[0] = Int.random(in:
0...self.symbols.count - 1)
self.numbers[1] = Int.random(in:
0...self.symbols.count - 1)
self.numbers[2] = Int.random(in:
0...self.symbols.count - 1)
//Check winnings
if self.numbers[0]
== self.numbers[1] && self.numbers[1] == self.numbers[2]{
}
}) {
Text("Spin")
.bold()
.foregroundColor(.white)
.padding(.all, 10)
.padding([.leading, .trailing], 30)
.background(Color.blue)
.cornerRadius(20)
}
Spacer()
}
}
}
}
The mistake is towards the front, where it is shown to me. I have no idea how to solve it! please help me!!! Thanks! (I added the var debug, to make my life simpler of finding the easier words of the bug, I tried deleting it, but another bug came up!) Thanks!