1

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.

4

1 回答 1

1

请参阅https://developer.apple.com/forums/thread/677361Enable Results应该关闭。

于 2021-04-02T10:24:46.363 回答