11

Take the following function:

func go() {
    return someTablePresenter.getSomeData();
}

When I set a breakpoint in this function, is there a possibility to inspect the returned value?

The only way to inspect the returned datatable is to use a temporary variable. However, that's a bit inconvenient.

Question: Isn't there another way?

3
  • 2
    Use po someTablePresenter.getSomeData() in console Commented Nov 30, 2018 at 11:02
  • However, that's a bit inconvenient. - why? Commented Nov 30, 2018 at 11:11
  • You can show the disassembly view and set a breakpoint on a specific instruction, including the return instruction. (The debugger may let you set a breakpoint on the closing brace of the function to achieve the same result.) At that point, you may have to examine registers to see the return value. Commented Dec 3, 2018 at 2:26

2 Answers 2

16

If you tap 'step out' then a 'return value' will appear in the debugger variable view source

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

2 Comments

O_o. 12 years working with Xcode, and I'd never seen that before. That's brilliant and comes up all the time. Thank you so much.
does it work with Xcode 15 or 16?
-3

When setting a break point, double click the line instead of single clicking. That should bring up this window:

double-click breakpoint

Once you see this, click add action, and you can make it automatically print out what you want to see once it hits the breakpoint.

add action

You can even set it to continue past the breakpoint so it will print and keep the program running.

Comments

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.