I'm trying to use SwiftUI on my iPad with Swift Playgrounds. The view below renders fine initially, but unfortunately the view does not update when @State
changes, like it does on my Mac. In the little sidebar I can see the closure does get executed though...
I'm using the newest non-beta version of everything.
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State private var tapCount = 0
var body: some View {
Button("Tap count: \(tapCount)") {
tapCount += 1
}
}
}
PlaygroundPage.current.setLiveView(ContentView())
Thanks.