Re: Can't see variable values in breakpoints


Alex Zavatone
 



On Jan 28, 2021, at 10:11 AM, Steve Mills via groups.io <sjmills@...> wrote:

On Jan 28, 2021, at 09:55, Alex Zavatone via groups.io <zav@...> wrote:

Never use the hover.   There is always a delay and it is a waste of time.  I always po or v the object.

Never?! Waste of time?! That’s completely ridiculous.

It is.  When you use my little tool, you’ll see that it’s MUCH faster to simply type 
po [myObject autoDescribe] 

or 

po myObject.autoDescribe 

or add this to you code 

NSLog(@“%@“, [myObject autoDescribe]);  

than it is to wait for the hover preview to show anything except an image.  Trrrry it.  

If you already have your hand on the mouse, it’s SO much quicker to hover over a variable than it is to move the mouse to the console pane (assuming you have it open), clicking in the free space, then typing “po variable”, especially when Xcode acts up and won’t autocomplete the long variable name, so you have to type the whole damn thing, hit return, then retype it when you spelled it wrong.

I got sick of waiting for the hover to work reliably and never looked back.  For long variable names, command c, command v does the trick.

If you have an object with multiple properties, this will display them and their values.  If there are arrays or dictionaries inside, it will display them.  If there are objects within, it wil recurse and display their contents.  

The hover window doesn’t do that.


Plus, hovering reveals the eye icon in the little floater, which is incredibly useful for seeing a preview of images, views, colors, etc, which po doesn’t do.


Hopefully, you’re using recursiveDescription with po to display your view hierarchy.  It doesn’t work in runtime though.  I know it works under iOS.

I’ve used a behaviour to make a window that’s the debugger and console.  But I’ll give you that.

I’ve run into enough problems in Xcode with trusting that the color shown is EXACTLY the color specified that I need to rely on the numbers.  Many times I’ve seen colors that are colors adjusted for the colorspace and not the exact RGB value specified.

Add the class I sent to your project’s .pch and try it out.

It’s another tool in the toolbox.  

Cheers,
Alex Zavatone

Join xcode@apple-dev.groups.io to automatically receive all group messages.