While debugging with lldb in Xcode I would like to see in a debugger window a simple summary string for NSIndexPath objects. Something like:
indexPath = (NSIndexPath *) { section=2 : row=0 }
would be much more helpful then what is displayed by lldb by default:
indexPath = (NSIndexPath *) [NSIndexPath * @ scalar section]
I did try many summary string formatters written to my .lldbinit file, with these among them:
type summary add NSIndexPath --summary-string '${var.section}'
type summary add NSIndexPath --summary-string '${[var section]}'
type summary add NSIndexPath --summary-string '[${var section}]'
type summary add NSIndexPath --summary-string '[${var} section]'
The result for first three is:
indexPath NSIndexPath * error: summary string parsing error 0x08e309a0
and for the last one is:
indexPath NSIndexPath * [NSIndexPath * @ scalar section] 0x08a45b80
which is not much more helpful neither.
Do you know how to force lldb to display some more useful summary string for NSIndexPath?
(lldb) type summary add NSIndexPath -s "${var%@}"
This will essentially show you the same output that
(lldb) po myIndexPath
would - at the cost of running an expression every time you're looking at an index path, which may or may not be what you want