Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Xcode have a watch window?

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.

like image 364
Chris Masterton Avatar asked Jun 28 '11 01:06

Chris Masterton


People also ask

How do I see variables in Xcode?

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.

What is PO in Xcode?

"po" means something like "print object".

How do you evaluate expressions in Xcode?

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.


2 Answers

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.

like image 105
Chris Masterton Avatar answered Sep 25 '22 15:09

Chris Masterton


Xcode Expression window

Open Debug Area via View -> Debug Area -> Activate Console (Xcode 9)

Right click -> Add Expression

like image 45
yoAlex5 Avatar answered Sep 25 '22 15:09

yoAlex5