iOS Dev Nugget 112 Format Specifiers for Numbers


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

Trouble remembering format specifiers for numbers in NSLog, etc? Check out this neat trick from Brent Simmons:

NSLog(@"t: %@", @([d2 timeIntervalSinceDate:d]));

Basically, covert them to NSNumber using @() and use the format specifier %@, which is for objects.

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