Clicky

iOS Dev Nugget 1 Easy logging of values and objects

.

Need to run a code review on your codebase? Hire me

Have many NSLog() calls, most of which is for printing out values or objects which you compose? Yes?

One of the most important tool in my iOS utility tool belt is LOG_EXPR(). It's written by Vincent Gable. Call LOG_EXPR() with a single value/object and it'll do the right thing.

int i = 3+4;    //do something to get i
LOG_EXPR(i);    //prints i = 7
CGRect rect = CGRectMake(10, 20, 30, 40);
LOG_EXPR(rect);  //prints rect = {{10, 20}, {30, 40}}

It'll work with most built-in classes and objects.

You can get the whole git repository or just the 2 header and implementation files.


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues