struct ContentView: View {
@State private var num = 0
var body: some View {
VStack{
Text(String(num))
.padding()
Button(action: {
num += 1
}, label: {Text("click+1")})
}
}
}
Question 1:
If I run the code above on simulator, I could get the value of "num" on the console by using"po _num".
However, if I run the code in previews(by "Debug-Attach to process"), I only get the error"error: :3:1: error: cannot find '_num' in scope" on the console by using"po _num"
Xcode 13.2.1
Question 2:
I could use "po num"/"po _num" to get the value of "num" with Xcode 12.
BUT, only "po _num" works in Xcode13. "po num" will raise the error:" error: Couldn't lookup symbols: Preview2.ContentView.num.getter : Swift.Int"
Any help will be appreciated.