Alex Rivera | Logout

Is It Possible to NSLog C Structs (Like CGRect or CGPoint)?

Asked 2009-02-15T02:28:30.300
418

I want to be able to debug C structures without having to explicitly type every property that they consist of.

i.e. I want to be able to do something like this:

CGPoint cgPoint = CGPointMake(0,0);
NSLog(@"%@",cgPoint);

Obviously the '%@' won't work, hence the question.

Edit
Report

1 Answer

5

Since Stack Overflow’s broken RSS just resurrected this question for me, here’s my almost-general solution: JAValueToString

This lets you write JA_DUMP(cgPoint) and get cgPoint = {0, 0} logged.

answered 2011-06-13T19:29:22.150

Your Answer