iOS Swift - State Management in SwiftUI
Given this code snippet, what will be printed when the button is tapped once?
class Counter: ObservableObject {
@Published var count = 0
}
struct ContentView: View {
@StateObject var counter = Counter()
var body: some View {
Button("Tap") {
counter.count += 1
print(counter.count)
}
}
}