3

I'm wondering if it's possible to change the description of variables in the Xcode debugger for example: Xcode Debugger

I'd like to change the text in the red boxes to depend on the object itself. Kind of how the NSArray has @"10 elements" as it's description.

5
  • Implement the description method on your custom class. Commented Aug 19, 2017 at 3:52
  • @rmaddy I tried that, it didn't work Commented Aug 19, 2017 at 3:55
  • You can change what appears in the console, not in the variables list. Commented Aug 19, 2017 at 3:58
  • @matt :( I'm sad now. Come on apple we need this! Commented Aug 19, 2017 at 4:03
  • 1
    You can also provide Quick Look rendering (for eyeball at bottom) Commented Aug 19, 2017 at 4:04

2 Answers 2

3

From Xcode Help:

To edit the summary format of a variable, Control-click the variable and choose Edit Summary Format… from the shortcut menu.

In the popover, enter a valid LLDB expression and click Done. This expression overrides the default formatter and is used to create a summary for all variables of this type.

Sign up to request clarification or add additional context in comments.

Comments

2

You can add the summary to class in debug console.

type summary add UITableViewCell -s "${var%@}"

That will print description instead of the memory address.

1 Comment

Don't forget to specify the module for Swift types: Module.Type

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.