Hey! I am trying to make a game and came across a problem. I simplified the problem by making a new program to test it out, and whenever I try to run it, it says that updating took more than 5 seconds, or nothing shows up at all. If anyone could help me make this work, or suggest a better way to do it, that would be awesome! Thanks! Here's my code
import SwiftUI
struct ContentView: View {
@State var numm = [0, 0]
@State var fill = 1
var body: some View {
VStack{
ForEach(1...(20), id: \.self) { box in
if numm.index(box.self, offsetBy: 0) == 1 {
Text("\(box.self)")
}
else {
Text("---")
}
}
}
}
init() {
fill = 0
numm.removeAll()
while fill < 20 {
numm.append(Int.random(in: 0...1))
fill += 1
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}