9.7 C
London
Saturday, October 28, 2023

ios – xcode debugger not exhibiting modifications to variables


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 wonderful. I’m within the debugger trying on the variable, it has the outdated worth, I step over the print and the brand new worth is within the console.

Numerous 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 degree, in each locations I modified each traces 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 price of 1 within the left window, it printed 1, I stepped over the subsequent assertion and the left window nonetheless confirmed a price 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 when you hover over a variable it’s going to 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 non-public var x = 1
    var physique: some View {
        VStack {
            Picture(systemName: "globe")
                .imageScale(.giant)
                .foregroundColor(.accentColor)
            Textual content("Hey, world!")
          Button ("hi") {
            print (x)
            x = 2
            print (x)
          }
        }
        .padding()
    }
}

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here