I am attempting to alter the background colour of the Textual content
part, each time a given situation is met, on this instance, when numberOfTaps = 3
, which I will do by having the situation contained in the .background
property name
What I am attempting to do is to alter the background with an animation, nothing too fancy, simply one thing like .easeInOut
may work; how can I try this?
import SwiftUI
struct ContentView: View {
@State personal var numberOfTaps = 0
var physique: some View {
VStack {
Button("Up") {
numberOfTaps += 1
}
Textual content("(numberOfTaps)")
.padding()
.background(numberOfTaps == 3 ? Colour.blue : Colour.inexperienced)
Button("Down") {
numberOfTaps -= 1
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Here is a pattern of the present UI: