Hi! I am trying to make a variable increase its value when pressing a button and if that value is greater than 2, +1 is added to another variable, I did it with an if that and at the time of writing that variable 2 adds its value tells me : Type '()' cannot conform to 'View'
struct SwiftUIView: View {
@AppStorage ("num1") var num1: Int = 0
@AppStorage ("num2") var num2: Int = 0
var body: some View {
VStack{
num1 = 2
if num1 2
{
num2 += 1
}
}
}
}
Selecting any option will automatically load the page