[swift-users] Customizing my custom type's appearance in the debugger
Dmitri Gribenko
gribozavr at gmail.com
Sun Jun 26 18:40:35 CDT 2016
On Fri, Jun 24, 2016 at 3:53 PM, Tim Vermeulen via swift-users
<swift-users at swift.org> wrote:
> I’ve implemented a linked list. Now I’d like to be able to view the elements of a linked list in the debugger just like with an array. In the debugger, an array is represented like this:
>
> [0] = the first element
> [1] = the second element
> etc
>
> I wonder if I can do the same for my linked list. I already implemented CustomReflectable, so the code `dump(myLinkedList)` shows this in the console:
>
> 3 elements
> - first element
> - second elements
> - third element
>
> I thought this would also change the appearance of my linked list in the debugger, but unfortunately it’s unchanged. Is there a way to do what I’m trying to do?
Try setting "displayStyle: .collection" when you call the Mirror initializer.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the swift-users
mailing list