I am using this down code but xCode doesn't compile even due to:
struct ContentView: View {
@State private var stringOfText: String = "Hello, world!"
let action: () -> Void = { stringOfText = "updated!" } // <<: Here
var body: some View {
Text(stringOfText)
.padding()
Button(action: action, label: {
Text("update")
})
}
}