Print Numbers to the Console Painlessly with this One Weird Trick

I’ve given up trying to remember NSLog number formatters. I was cool with it until Macs got 64-bit processors — and then I just lost it when I stopped being able to use %d most of the time.

And now I’ve given up even looking up the number formatters. With the new literals syntax it’s just so easy — as in this line of code I just wrote:

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

What did I want? %f? I don’t need to know or care.

25 Nov 2014

Archive