Hi,
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.
Thanks.
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.
Code Block swift 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.
I have run your code and experienced the same problem. You can fix this by clicking on the speedometer button in the bottom left of the canvas and turning off Enable Results.
The labels to the right of the lines of code will disappear but that is at the cost of improving performance. This is either a bug with Playgrounds or an intentional feature.
My advice is that when using SwiftUI, turn off this setting so that Playgrounds doesn’t have to work any harder to give you the extra results and instead focuses on rendering your views in the canvas.
The labels to the right of the lines of code will disappear but that is at the cost of improving performance. This is either a bug with Playgrounds or an intentional feature.
My advice is that when using SwiftUI, turn off this setting so that Playgrounds doesn’t have to work any harder to give you the extra results and instead focuses on rendering your views in the canvas.