Does Xcode have a watch window for variables? It has a window for local variables but that's not much help when I want to watch the value of a global.
I've been spoiled by VisualStudio, I know.
We can show or hide the variables view and the console by clicking the middle view control at the top right or by clicking the leftmost button of the debug bar. The variables view is empty at the moment because the application isn't paused.
"po" means something like "print object".
Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope. This command takes 'raw' input (no need to quote stuff). -G <gdb-format> ( --gdb-format <gdb-format> ) Specify a format using a GDB format specifier string.
Solved! Right-clicking in the local variables window brings a menu option of "Add Expression". Type your variable name and now you are watching your variable/expression.
The language of "expression" instead of the more familiar "variable" threw me quite a bit. Hard to search for a solution when I have the terminology wrong. Seems obvious now.
Xcode Expression window
Open Debug Area via View -> Debug Area -> Activate Console
(Xcode 9)
Right click -> Add Expression
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With