Yes @Andrei G. is right .. you need to use @state variable as structs are value types ..
struct SwiftUIDemo: View {
@State var tapCount = 0
var body: some View {
Button("Tap Count: \(tapCount)") {
self.incrementCount()
}
}
func incrementCount() {
self.tapCount += 1
print(tapCount)
}
}