I’ve an IOS app and when I’m stopped within the debugger I don’t see modifications to variables. I click on the > by self and see the variable and click on the > subsequent to it and see the worth. My code units it to a brand new worth. Within the debug window it doesn’t change. Within the code I print the variable earlier than and after I alter it, the prints work fantastic. I’m within the debugger trying on the variable, it has the previous worth, I step over the print and the brand new worth is within the console.
A whole lot of stuff on stackoverlow references not debug or optimizing code. I’ve not touched something within the construct part and, so far as I can inform, I’m utilizing debug with no optimizations. I went into the settings for the app and debug was no optimization and I ran the app with no modifications. I later went again in and located 2 locations that had optimization stage, in each locations I modified each strains to be no optimization, this modified nothing.
I constructed a brand new app and , I broke it on the first print, ran it, on the first print x had a worth of 1 within the left window, it printed 1, I stepped over the following assertion and the left window nonetheless confirmed a worth of 1, it printed 2.
When it begins the console has no warnings/errors. simply says (lldb).
One unusual factor was that I’ve seen doc that claims if you happen to hover over a variable it should show. When it’s broke I hover over variables, for over 10 seconds, and nothing occurs.
Model 14.3.1 (14E300c) of xcode and Model 14.3.1 (994) of the simulator. iPhone 14 Professional, IOS 16.4 simulated.
The brand new app is the default with an added @State variable and a button.
import SwiftUI
struct ContentView: View {
@State personal var x = 1
var physique: some View {
VStack {
Picture(systemName: "globe")
.imageScale(.massive)
.foregroundColor(.accentColor)
Textual content("Hey, world!")
Button ("hi") {
print (x)
x = 2
print (x)
}
}
.padding()
}
}