In MS visual studio we just right click add watch.
How does one do this in Xcode?
If you want to know when the variable changes, use a "watch":
For example, here, I've stopped at a breakpoint in viewDidLoad
, and added a "watch" for total
:
(This is Swift, but the same is true for Objective-C, too.)
Now, if I "continue" execution (), Xcode will pause whenever this property changes and I can see at what line of code total
is changing, the stack trace to get to that point, etc.